diff options
author | Jonathan Bauer | 2019-04-04 15:41:07 +0200 |
---|---|---|
committer | Jonathan Bauer | 2019-04-04 15:41:07 +0200 |
commit | 55ec690b8851105d7d3e69f7d2ab0b0e55e66cdb (patch) | |
tree | 58f50dc8bdc013ebbe9651f9cbde8dcf71ac148b /dozentenmodul | |
parent | [client] netshare: fix username/password not disabled when predef share (diff) | |
download | tutor-module-55ec690b8851105d7d3e69f7d2ab0b0e55e66cdb.tar.gz tutor-module-55ec690b8851105d7d3e69f7d2ab0b0e55e66cdb.tar.xz tutor-module-55ec690b8851105d7d3e69f7d2ab0b0e55e66cdb.zip |
[client] startup: prettier layout
Diffstat (limited to 'dozentenmodul')
-rwxr-xr-x | dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/StartupConfigurator.java | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/StartupConfigurator.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/StartupConfigurator.java index 5c3411d7..5283baf4 100755 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/StartupConfigurator.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/configurator/StartupConfigurator.java @@ -2,13 +2,12 @@ package org.openslx.dozmod.gui.configurator; import java.awt.Color; import java.awt.Dialog.ModalityType; +import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.StringReader; +import java.awt.event.KeyEvent; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -21,12 +20,15 @@ import javax.swing.ButtonModel; import javax.swing.DefaultComboBoxModel; import javax.swing.JButton; import javax.swing.JCheckBox; +import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JTextField; +import javax.swing.KeyStroke; import javax.swing.SwingUtilities; +import javax.swing.border.EmptyBorder; import org.openslx.bwlp.thrift.iface.ImageDetailsRead; import org.openslx.bwlp.thrift.iface.LectureRead; @@ -97,16 +99,27 @@ public class StartupConfigurator extends StartupConfiguratorLayout { return; } final JDialog dialog = new JDialog(SwingUtilities.getWindowAncestor(this), - "Startscripte auswählen", ModalityType.APPLICATION_MODAL); + "Auswahl", ModalityType.APPLICATION_MODAL); JPanel pane = new JPanel(); + pane.setBorder(new EmptyBorder(new Insets(10, 5, 5, 10))); + pane.registerKeyboardAction(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + dialog.dispose(); + } + }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW); dialog.setContentPane(pane); - dialog.setMinimumSize(Gui.getScaledDimension(200, 300)); - GridManager grid = new GridManager(pane, 2, true, new Insets(2, 2, 2, 2)); + Dimension dd = Gui.getScaledDimension(300, 250 + 15 * scripts.size()); + dialog.setMinimumSize(dd); + dialog.setPreferredSize(dd); + GridManager grid = new GridManager(pane, 3, true, new Insets(2, 2, 2, 2)); + grid.add(new WordWrapLabel("Vordefinierte Startskripte:"), 3).fill(true, false); + grid.nextRow(); final Map<ButtonModel, Integer> mapper = new HashMap<>(); boolean haveDisabled = false; for (PresetRunScript ruleSet : scripts) { JCheckBox button = new JCheckBox(ruleSet.displayname); - grid.add(button, 2); + grid.add(button, 3); grid.nextRow(); mapper.put(button.getModel(), ruleSet.scriptId); if (image != null && ruleSet.osIds != null @@ -120,14 +133,18 @@ public class StartupConfigurator extends StartupConfiguratorLayout { } if (haveDisabled) { grid.add(new WordWrapLabel("Ausgegraute Elemente sind mit dem zur" - + " Veranstaltung gehörendem Betriebssystem nicht kompatibel"), 2); + + " Veranstaltung gehörendem Betriebssystem nicht kompatibel."), 3) + .fill(true, false); grid.nextRow(); } + grid.add(Box.createVerticalGlue(), 3).expand(true, true).fill(true, true); + grid.nextRow(); JButton btnCancel = new JButton("Abbrechen"); - JButton btnOk = new JButton("SPASCHAN"); - grid.add(btnCancel).anchor(GridBagConstraints.LINE_START); - grid.add(btnOk).anchor(GridBagConstraints.LINE_END); - grid.finish(true); + JButton btnOk = new JButton("Speichern"); + grid.add(Box.createHorizontalGlue()).expand(true, true).fill(true, true); + grid.add(btnCancel); + grid.add(btnOk); + grid.finish(false); btnCancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { |