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

Last change on this file since 660 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
Line 
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;
8import javax.swing.JCheckBox;
9import javax.swing.JComboBox;
10import javax.swing.JComponent;
11import javax.swing.JDialog;
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 */
24public class SettingsDialog extends JDialog {
25 private static final long serialVersionUID = -5719515325671846620L;
26
27 private ResourceBundle bundle = ResourceBundle
28 .getBundle("net.oni2.aeinstaller.localization."
29 + getClass().getSimpleName());
30 @SuppressWarnings("unused")
31 private BuildResult result = SwingJavaBuilder.build(this, bundle);
32
33 private JComboBox cmbLaF;
34 private LaFComboModel laFModel;
35
36 private JCheckBox chkNotifyOnStart;
37 private JCheckBox chkNotifyDepsAfterInstall;
38 private JCheckBox chkCopyIntro;
39 private JCheckBox chkCopyOutro;
40
41 /**
42 * Open the settings
43 */
44 public SettingsDialog() {
45 setResizable(false);
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();
63
64 setLocationRelativeTo(null);
65 }
66
67 private void initValues() {
68 Settings set = Settings.getInstance();
69
70 laFModel = new LaFComboModel();
71 cmbLaF.setModel(laFModel);
72
73 chkNotifyOnStart.setSelected(set.get("notifyupdates", true));
74 chkNotifyDepsAfterInstall.setSelected(set.get("notifyDepsAfterInstall", false));
75 chkCopyIntro.setSelected(set.get("copyintro", false));
76 chkCopyOutro.setSelected(set.get("copyoutro", true));
77 }
78
79 @SuppressWarnings("unused")
80 private boolean save() {
81 Settings set = Settings.getInstance();
82
83 set.put("notifyupdates", chkNotifyOnStart.isSelected());
84 set.put("notifyDepsAfterInstall", chkNotifyDepsAfterInstall.isSelected());
85 set.put("copyintro", chkCopyIntro.isSelected());
86 set.put("copyoutro", chkCopyOutro.isSelected());
87
88 String oldLaf = set.get("lookandfeel", UIManager.getLookAndFeel()
89 .getClass().getName());
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.