···11+Star Rod can use custom themes desgined for IntelliJ.
22+You can browse a collection of themes here:
1322-Custom Themes:
44+https://plugins.jetbrains.com/search?tags=Theme
3544-Star Rod can use custom themes desgined for IntelliJ via a .theme.json file.
55-You can browse a collection of such themes here:
66-77-https://plugins.jetbrains.com/search?headline=0-theme&tags=Theme
88-99-Find a theme you like and click "Souce File" to browse for the necessary file.
1010-Place the file anywhere in this folder and the custom theme will show up in
1111-the theme editor when you run Star Rod.
66+Find a theme you like and download it as a JAR file.
77+Place the JAR in this folder and the custom theme will show
88+up in the theme editor next time you run Star Rod.
···99import javax.swing.JButton;
1010import javax.swing.JCheckBox;
1111import javax.swing.JComboBox;
1212+import javax.swing.JFrame;
1213import javax.swing.JLabel;
1314import javax.swing.JList;
1415import javax.swing.JOptionPane;
···2223import javax.swing.ListSelectionModel;
2324import javax.swing.SwingConstants;
2425import javax.swing.SwingUtilities;
2525-import javax.swing.WindowConstants;
2626import javax.swing.tree.DefaultMutableTreeNode;
2727import javax.swing.tree.DefaultTreeModel;
28282929+import app.Themes.Theme;
2930import app.config.Options;
3031import net.miginfocom.swing.MigLayout;
3132···3738 private StarRodFrame frame;
3839 public boolean exitToMainMenu;
39404040- public String initialThemeName;
4141+ public Theme initialTheme;
41424243 private JLabel lblR;
4344 private JLabel lblG;
···56575758 public ThemesEditor(CountDownLatch guiClosedSignal)
5859 {
5959- initialThemeName = Themes.getCurrentThemeName();
6060+ initialTheme = Themes.getCurrentTheme();
60616162 frame = new StarRodFrame();
6263···6566 frame.setBounds(0, 0, WINDOW_SIZE_X, WINDOW_SIZE_Y);
6667 frame.setLocationRelativeTo(null);
67686868- frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
6969+ frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
6970 frame.addWindowListener(new WindowAdapter() {
7071 @Override
7172 public void windowClosing(WindowEvent e)
7273 {
7374 exitToMainMenu = true;
7474- String currentThemeName = Themes.getCurrentThemeName();
7575- if (!initialThemeName.equals(currentThemeName)) {
7575+ Theme currentTheme = Themes.getCurrentTheme();
7676+ if (initialTheme != currentTheme) {
7677 int choice = SwingUtils.getConfirmDialog()
7778 .setTitle("Save Changes")
7879 .setMessage("Theme has been changed.", "Do you want to save changes?")
···80818182 switch (choice) {
8283 case JOptionPane.YES_OPTION:
8383- Environment.mainConfig.setString(Options.Theme, Themes.getCurrentThemeKey());
8484- Environment.mainConfig.saveConfigFile();
8585-8686- SwingUtils.getWarningDialog()
8787- .setTitle("Theme Changed")
8888- .setMessage("Theme has been changed.", "Star Rod must restart.")
8989- .show();
8484+ if (Themes.getCurrentTheme() != null) {
8585+ Environment.mainConfig.setString(Options.Theme, Themes.getCurrentTheme().key);
8686+ Environment.mainConfig.saveConfigFile();
90879191- Environment.exit();
8888+ SwingUtils.getWarningDialog()
8989+ .setTitle("Theme Changed")
9090+ .setMessage("Theme has been changed.", "Star Rod must restart.")
9191+ .show();
9292+ }
9393+ exitToMainMenu = false;
9294 break;
9395 case JOptionPane.NO_OPTION:
9494- Themes.setThemeByName(initialThemeName);
9696+ Themes.setTheme(initialTheme);
9597 SwingUtilities.updateComponentTreeUI(frame);
9698 break;
9799 case JOptionPane.CANCEL_OPTION:
···113115114116 private JPanel getThemesPanel()
115117 {
116116- DefaultListModel<String> themes = new DefaultListModel<>();
118118+ DefaultListModel<Theme> themes = new DefaultListModel<>();
117119118118- for (String name : Themes.getThemeNames())
119119- themes.addElement(name);
120120+ for (Theme theme : Themes.getThemes())
121121+ themes.addElement(theme);
120122121121- JList<String> themeList = new JList<>(themes);
123123+ JList<Theme> themeList = new JList<>(themes);
122124 themeList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
123125124124- themeList.setSelectedValue(Themes.getCurrentThemeName(), true);
126126+ themeList.setSelectedValue(Themes.getCurrentTheme(), true);
125127126128 themeList.addListSelectionListener(e -> SwingUtilities.invokeLater(() -> {
127127- Themes.setThemeByName(themeList.getSelectedValue());
129129+ Themes.setTheme(themeList.getSelectedValue());
128130 SwingUtilities.updateComponentTreeUI(frame);
129131 lblR.setForeground(SwingUtils.getRedTextColor());
130132 lblG.setForeground(SwingUtils.getGreenTextColor());
+2-2
src/main/java/util/CaseInsensitiveMap.java
···11package util;
2233import java.util.Collection;
44-import java.util.HashMap;
44+import java.util.LinkedHashMap;
5566public class CaseInsensitiveMap<T>
77{
88- private final HashMap<String, T> map = new HashMap<>();
88+ private final LinkedHashMap<String, T> map = new LinkedHashMap<>();
991010 public T put(String key, T value)
1111 {