1 | private static final class OyoahaPrefsPanel extends BaseLAFPreferencesPanelComponent↵ | | 1 | private static final class SkinPrefsPanel extends BaseLAFPreferencesPanelComponent↵
|
2 | {↵ | | 2 | {↵
|
3 | private static final long serialVersionUID = 1L;↵ | | 3 | private static final long serialVersionUID = 1L;↵
|
|
4 | /**↵ | | 4 | /**↵
|
5 | * This interface defines locale specific strings. This should be↵ | | 5 | * This interface defines locale specific strings. This should be↵
|
6 | * replaced with a property file.↵ | | 6 | * replaced with a property file.↵
|
7 | */↵ | | 7 | */↵
|
8 | interface OyoahaPrefsPanelI18n↵ | | 8 | interface SkinPrefsPanelI18n↵
|
9 | {↵ | | 9 | {↵
|
10 | // i18n[laf.themePack=Theme Pack:]↵ | | 10 | // i18n[laf.skinThemPack=Theme Pack:]↵
|
11 | String THEME_PACK = s_stringMgr.getString("laf.themePack");↵ | | 11 | String THEME_PACK = s_stringMgr.getString("laf.skinThemPack");↵
|
12 | // i18n[laf.themePacLoc=Theme Pack Directory:]↵ | | 12 | // i18n[laf.skinThemePackDir=Theme Pack Directory:]↵
|
13 | String THEMEPACK_LOC = s_stringMgr.getString("laf.themePacLoc");↵ | | 13 | String THEMEPACK_LOC = s_stringMgr.getString("laf.skinThemePackDir");↵
|
14 | }↵ | | 14 | }↵
|
|
15 | private OyoahaLookAndFeelController _ctrl;↵ | | 15 | private SkinLookAndFeelController _ctrl;↵
|
16 | private DirectoryListComboBox _themePackCmb = new DirectoryListComboBox();↵ | | 16 | private DirectoryListComboBox _themePackCmb = new DirectoryListComboBox();↵
|
|
17 | OyoahaPrefsPanel(OyoahaLookAndFeelController ctrl)↵ | | 17 | SkinPrefsPanel(SkinLookAndFeelController ctrl)↵
|
18 | {↵ | | 18 | {↵
|
19 | super(new GridBagLayout());↵ | | 19 | super(new GridBagLayout());↵
|
20 | _ctrl = ctrl;↵ | | 20 | _ctrl = ctrl;↵
|
21 | createUserInterface();↵ | | 21 | createUserInterface();↵
|
22 | }↵ | | 22 | }↵
|
|
23 | private void createUserInterface()↵ | | 23 | private void createUserInterface()↵
|
24 | {↵ | | 24 | {↵
|
25 | final GridBagConstraints gbc = new GridBagConstraints();↵ | | 25 | final GridBagConstraints gbc = new GridBagConstraints();↵
|
26 | gbc.anchor = GridBagConstraints.WEST;↵ | | 26 | gbc.anchor = GridBagConstraints.WEST;↵
|
27 | gbc.fill = GridBagConstraints.HORIZONTAL;↵ | | 27 | gbc.fill = GridBagConstraints.HORIZONTAL;↵
|
28 | gbc.insets = new Insets(4, 4, 4, 4);↵ | | 28 | gbc.insets = new Insets(4, 4, 4, 4);↵
|
|
29 | gbc.gridx = 0;↵ | | 29 | gbc.gridx = 0;↵
|
30 | gbc.gridy = 0;↵ | | 30 | gbc.gridy = 0;↵
|
31 | add(new JLabel(OyoahaPrefsPanelI18n.THEME_PACK, SwingConstants.RIGHT), gbc);↵ | | 31 | add(new JLabel(SkinPrefsPanelI18n.THEME_PACK, SwingConstants.RIGHT), gbc);↵
|
|
32 | ++gbc.gridx;↵ | | 32 | ++gbc.gridx;↵
|
33 | add(_themePackCmb, gbc);↵ | | 33 | add(_themePackCmb, gbc);↵
|
|
34 | gbc.gridx = 0;↵ | | 34 | gbc.gridx = 0;↵
|
35 | ++gbc.gridy;↵ | | 35 | ++gbc.gridy;↵
|
36 | add(new JLabel(OyoahaPrefsPanelI18n.THEMEPACK_LOC, SwingConstants.RIGHT), gbc);↵ | | 36 | add(new JLabel(SkinPrefsPanelI18n.THEMEPACK_LOC, SwingConstants.RIGHT), gbc);↵
|
|
37 | ++gbc.gridx;↵ | | 37 | ++gbc.gridx;↵
|
38 | final String themePackDir = _ctrl._prefs.getThemePackDirectory();↵ | | 38 | final String themePackDir = _ctrl._prefs.getThemePackDirectory();↵
|
39 | add(new OutputLabel(themePackDir), gbc);↵ | | 39 | add(new OutputLabel(themePackDir), gbc);↵
|
40 | }↵ | | 40 | }↵
|
41 | ↵ | | 41 | ↵
|
42 | /**↵ | | 42 | /**↵
|
43 | * @see BaseLAFPreferencesPanelComponent#loadPreferencesPanel()↵ | | 43 | * @see BaseLAFPreferencesPanelComponent#loadPreferencesPanel()↵
|
44 | */↵ | | 44 | */↵
|
45 | public void loadPreferencesPanel()↵ | | 45 | public void loadPreferencesPanel()↵
|
46 | {↵ | | 46 | {↵
|
47 | super.loadPreferencesPanel();↵ | | 47 | super.loadPreferencesPanel();↵
|
48 | final String themePackDir = _ctrl._prefs.getThemePackDirectory();↵ | | 48 | final String themePackDir = _ctrl._prefs.getThemePackDirectory();↵
|
49 | // i18n[laf.otmFiles=OTM files]↵ | | 49 | // i18n[laf.jarZip=JAR/Zip files]↵
|
50 | final FileExtensionFilter filter = new FileExtensionFilter(s_stringMgr.getString("laf.otmFiles"), new String[] {".otm"});↵ | | 50 | final FileExtensionFilter filter = new FileExtensionFilter(s_stringMgr.getString("laf.jarZip"), new String[] { ".jar", ".zip" });↵
|
51 | _themePackCmb.load(new File(themePackDir), filter);↵ | | 51 | _themePackCmb.load(new File(themePackDir), filter);↵
|
52 | _themePackCmb.setSelectedItem(_ctrl._prefs.getThemePackName());↵ | | 52 | _themePackCmb.setSelectedItem(_ctrl._prefs.getThemePackName());↵
|
53 | if (_themePackCmb.getSelectedIndex() == -1 &&↵ | | 53 | if (_themePackCmb.getSelectedIndex() == -1 &&↵
|
54 | _themePackCmb.getModel().getSize() > 0)↵ | | 54 | _themePackCmb.getModel().getSize() > 0)↵
|
55 | {↵ | | 55 | {↵
|
56 | _themePackCmb.setSelectedIndex(0);↵ | | 56 | _themePackCmb.setSelectedIndex(0);↵
|
57 | }↵ | | 57 | }↵
|
58 | }↵ | | 58 | }↵
|
|
59 | /**↵ | | 59 | /**↵
|
60 | * @see BaseLAFPreferencesPanelComponent#applyChanges()↵ | | 60 | * @see BaseLAFPreferencesPanelComponent#applyChanges()↵
|
61 | */↵ | | 61 | */↵
|
62 | public boolean applyChanges()↵ | | 62 | public boolean applyChanges()↵
|
63 | {↵ | | 63 | {↵
|
64 | super.applyChanges();↵ | | 64 | super.applyChanges();↵
|
65 | _ctrl._prefs.setThemePackName((String)_themePackCmb.getSelectedItem());↵ | | 65 | _ctrl._prefs.setThemePackName((String)_themePackCmb.getSelectedItem());↵
|
66 | return fals↵ | | 66 | ↵
|
| | | 67 | // Force the LAF to be set even if Skin is the current one. This↵
|
| | | 68 | // allows a change in theme to take affect.↵
|
67 | e | | 69 | return true
|