package org.openslx.dozmod.gui.window.layout; import java.awt.Dimension; import java.awt.Insets; import java.awt.Window; import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JEditorPane; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import org.openslx.dozmod.gui.Gui; import org.openslx.dozmod.gui.helper.GridManager; @SuppressWarnings("serial") public class VirtConfigEditorWindowLayout extends JDialog { private static String title = "VM-Konfiguration Editor"; protected final JScrollPane pnlScrollPane; protected final JEditorPane pnlEditor; protected final JButton btnSave; protected final JButton btnCancel; protected VirtConfigEditorWindowLayout(Window modalParent) { super(modalParent, title, modalParent != null ? ModalityType.APPLICATION_MODAL : ModalityType.MODELESS); GridManager grid = new GridManager(this, 1, true, new Insets(2, 2, 2, 2)); JPanel pnlWarning = new JPanel(); pnlWarning.setBorder(BorderFactory.createTitledBorder("WARNUNG")); pnlWarning.add(new JLabel( "Änderungen an der VM-Konfiguration können zu Funktionsstörungen führen.
Benutzung auf eigene Gefahr!")); pnlEditor = new JEditorPane("text/plain", null); pnlScrollPane = new JScrollPane(pnlEditor, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); grid.add(pnlWarning).fill(true, false).expand(true, false); grid.nextRow(); grid.add(pnlScrollPane).expand(true, true).fill(true, true); grid.nextRow(); JPanel buttonPane = new JPanel(); buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS)); buttonPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); buttonPane.add(Box.createHorizontalGlue()); btnCancel = new JButton("Abbrechen"); buttonPane.add(btnCancel); buttonPane.add(Box.createRigidArea(new Dimension(10, 0))); btnSave = new JButton("Speichern"); buttonPane.add(btnSave); grid.add(buttonPane).fill(true, false).expand(true, false); ; grid.finish(false); setPreferredSize(Gui.getScaledDimension(650, 750)); setMinimumSize(Gui.getScaledDimension(550, 650)); if (modalParent != null) { Gui.centerShellOverShell(modalParent, this); } } }