diff options
| author | 2017-06-07 08:29:37 +0100 | |
|---|---|---|
| committer | 2017-06-07 08:29:37 +0100 | |
| commit | ba5ffc258f6d58bf9d01226baea016db10cfd811 (patch) | |
| tree | 4fd3b77e619198a47d95ee55a742c8057dea591a /src/main/java/cuchaz/enigma/gui/elements | |
| parent | Add support for custom themes (#59) (diff) | |
| download | enigma-fork-ba5ffc258f6d58bf9d01226baea016db10cfd811.tar.gz enigma-fork-ba5ffc258f6d58bf9d01226baea016db10cfd811.tar.xz enigma-fork-ba5ffc258f6d58bf9d01226baea016db10cfd811.zip | |
Added theme switcher + dark theme (#60)
* Initial work on the color config
* Save and read config from file.+
* Allow changing the editor colors
* Remove the right margin
* Move config to the user's home dir
* Use Guava instead of Apache commons
* Add runtime theme switching, includes example "dark" theme.
* Rename dark theme as requested
* Small clean up
* Include suggestions from @Thog
Diffstat (limited to 'src/main/java/cuchaz/enigma/gui/elements')
| -rw-r--r-- | src/main/java/cuchaz/enigma/gui/elements/MenuBar.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/main/java/cuchaz/enigma/gui/elements/MenuBar.java b/src/main/java/cuchaz/enigma/gui/elements/MenuBar.java index e446c5a..c0568bf 100644 --- a/src/main/java/cuchaz/enigma/gui/elements/MenuBar.java +++ b/src/main/java/cuchaz/enigma/gui/elements/MenuBar.java | |||
| @@ -1,5 +1,7 @@ | |||
| 1 | package cuchaz.enigma.gui.elements; | 1 | package cuchaz.enigma.gui.elements; |
| 2 | 2 | ||
| 3 | import cuchaz.enigma.config.Config; | ||
| 4 | import cuchaz.enigma.config.Themes; | ||
| 3 | import cuchaz.enigma.gui.Gui; | 5 | import cuchaz.enigma.gui.Gui; |
| 4 | import cuchaz.enigma.gui.dialog.AboutDialog; | 6 | import cuchaz.enigma.gui.dialog.AboutDialog; |
| 5 | import cuchaz.enigma.throwables.MappingParseException; | 7 | import cuchaz.enigma.throwables.MappingParseException; |
| @@ -211,6 +213,35 @@ public class MenuBar extends JMenuBar { | |||
| 211 | } | 213 | } |
| 212 | } | 214 | } |
| 213 | { | 215 | { |
| 216 | JMenu menu = new JMenu("View"); | ||
| 217 | this.add(menu); | ||
| 218 | { | ||
| 219 | JMenu themes = new JMenu("Themes"); | ||
| 220 | menu.add(themes); | ||
| 221 | { | ||
| 222 | JMenuItem defaultTheme = new JMenuItem("Default"); | ||
| 223 | themes.add(defaultTheme); | ||
| 224 | defaultTheme.addActionListener(event -> Themes.setDefault(gui)); | ||
| 225 | JMenuItem dark = new JMenuItem("Dank"); | ||
| 226 | themes.add(dark); | ||
| 227 | dark.addActionListener(event -> Themes.setDark(gui)); | ||
| 228 | themes.addSeparator(); | ||
| 229 | JMenuItem refresh = new JMenuItem("Reload From config"); | ||
| 230 | themes.add(refresh); | ||
| 231 | refresh.addActionListener(event -> { | ||
| 232 | try { | ||
| 233 | Config.getInstance().reset(); | ||
| 234 | Config.getInstance().saveConfig(); | ||
| 235 | Themes.updateTheme(gui); | ||
| 236 | } catch (IOException e) { | ||
| 237 | e.printStackTrace(); | ||
| 238 | } | ||
| 239 | }); | ||
| 240 | } | ||
| 241 | |||
| 242 | } | ||
| 243 | } | ||
| 244 | { | ||
| 214 | JMenu menu = new JMenu("Help"); | 245 | JMenu menu = new JMenu("Help"); |
| 215 | this.add(menu); | 246 | this.add(menu); |
| 216 | { | 247 | { |