source: AE/installer2/src/net/oni2/aeinstaller/gui/settings/SettingsDialog.java@ 695

Last change on this file since 695 was 646, checked in by alloc, 12 years ago

AEI2 0.99c:

  • Download window: Show which file is currently being downloaded and if it is an automaticly resolved dependency
  • Added mandatory packages dialog
  • Added option to show automatic resolved dependencies after installation is done instead of interrupting installation process to ask whether to continue
  • ToolManager: version number + last change added
  • Correct output of download-size in mainwin after installation of mods done
File size: 2.9 KB
RevLine 
[591]1package net.oni2.aeinstaller.gui.settings;
2
3import java.awt.event.ActionEvent;
4import java.awt.event.KeyEvent;
5import java.util.ResourceBundle;
6
7import javax.swing.AbstractAction;
[608]8import javax.swing.JCheckBox;
[591]9import javax.swing.JComboBox;
10import javax.swing.JComponent;
[593]11import javax.swing.JDialog;
[591]12import javax.swing.JOptionPane;
13import javax.swing.KeyStroke;
14import javax.swing.UIManager;
15
16import net.oni2.aeinstaller.backend.Settings;
17
18import org.javabuilders.BuildResult;
19import org.javabuilders.swing.SwingJavaBuilder;
20
21/**
22 * @author Christian Illy
23 */
[593]24public class SettingsDialog extends JDialog {
[591]25 private static final long serialVersionUID = -5719515325671846620L;
26
[629]27 private ResourceBundle bundle = ResourceBundle
28 .getBundle("net.oni2.aeinstaller.localization."
29 + getClass().getSimpleName());
[591]30 @SuppressWarnings("unused")
31 private BuildResult result = SwingJavaBuilder.build(this, bundle);
32
33 private JComboBox cmbLaF;
34 private LaFComboModel laFModel;
35
[608]36 private JCheckBox chkNotifyOnStart;
[646]37 private JCheckBox chkNotifyDepsAfterInstall;
[625]38 private JCheckBox chkCopyIntro;
39 private JCheckBox chkCopyOutro;
[608]40
[591]41 /**
[593]42 * Open the settings
[591]43 */
[593]44 public SettingsDialog() {
[609]45 setResizable(false);
[591]46
47 AbstractAction closeAction = new AbstractAction() {
48
49 private static final long serialVersionUID = 1L;
50
51 public void actionPerformed(ActionEvent arg0) {
52 dispose();
53 }
54 };
55 KeyStroke ksCtrlW = KeyStroke
56 .getKeyStroke('W', KeyEvent.CTRL_DOWN_MASK);
57 getRootPane()
58 .getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
59 .put(ksCtrlW, "close");
60 getRootPane().getActionMap().put("close", closeAction);
61
62 initValues();
[641]63
64 setLocationRelativeTo(null);
[591]65 }
66
67 private void initValues() {
68 Settings set = Settings.getInstance();
69
70 laFModel = new LaFComboModel();
71 cmbLaF.setModel(laFModel);
[608]72
73 chkNotifyOnStart.setSelected(set.get("notifyupdates", true));
[646]74 chkNotifyDepsAfterInstall.setSelected(set.get("notifyDepsAfterInstall", false));
[625]75 chkCopyIntro.setSelected(set.get("copyintro", false));
76 chkCopyOutro.setSelected(set.get("copyoutro", true));
[591]77 }
78
79 @SuppressWarnings("unused")
80 private boolean save() {
81 Settings set = Settings.getInstance();
82
[625]83 set.put("notifyupdates", chkNotifyOnStart.isSelected());
[646]84 set.put("notifyDepsAfterInstall", chkNotifyDepsAfterInstall.isSelected());
[625]85 set.put("copyintro", chkCopyIntro.isSelected());
86 set.put("copyoutro", chkCopyOutro.isSelected());
[608]87
88 String oldLaf = set.get("lookandfeel", UIManager.getLookAndFeel()
89 .getClass().getName());
[591]90 String newLaf = laFModel.getSelectedClassName();
91
92 if (!newLaf.equals(oldLaf)) {
93 set.put("lookandfeel", newLaf);
94 JOptionPane.showMessageDialog(this,
95 bundle.getString("newLaF.text"),
96 bundle.getString("newLaF.title"),
97 JOptionPane.INFORMATION_MESSAGE);
98 }
99
100 return true;
101 }
102
103}
Note: See TracBrowser for help on using the repository browser.