X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=inline;f=src%2Fnet%2Fpterodactylus%2Fjsite%2Fgui%2FSwingInterface.java;h=dff6f3a2ae3c6942bce6f424ec0c68441282b519;hb=83250636518e229320ac696ff580b710ea8207b7;hp=b2c7c92fed9ed521278a08944b646f71792ac670;hpb=238ddd807f329f3bca74572a2be011dd42167f73;p=jSite2.git diff --git a/src/net/pterodactylus/jsite/gui/SwingInterface.java b/src/net/pterodactylus/jsite/gui/SwingInterface.java index b2c7c92..dff6f3a 100644 --- a/src/net/pterodactylus/jsite/gui/SwingInterface.java +++ b/src/net/pterodactylus/jsite/gui/SwingInterface.java @@ -40,6 +40,8 @@ import java.util.logging.Logger; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.JOptionPane; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; import net.pterodactylus.jsite.core.Core; import net.pterodactylus.jsite.core.CoreListener; @@ -156,6 +158,9 @@ public class SwingInterface implements CoreListener, LoggingListener { /** The user font. */ private String userFont; + /** The class name of the look and feel. */ + private String lookAndFeel; + /** * Creates a new swing interface. * @@ -169,6 +174,19 @@ public class SwingInterface implements CoreListener, LoggingListener { this.configDirectory = configDirectory; I18n.setLocale(Locale.ENGLISH); loadConfig(); + if (lookAndFeel != null) { + try { + UIManager.setLookAndFeel(lookAndFeel); + } catch (ClassNotFoundException cnfe1) { + logger.log(Level.WARNING, "could not load look and feel", cnfe1); + } catch (InstantiationException ie1) { + logger.log(Level.WARNING, "could not load look and feel", ie1); + } catch (IllegalAccessException iae1) { + logger.log(Level.WARNING, "could not load look and feel", iae1); + } catch (UnsupportedLookAndFeelException ulafe1) { + logger.log(Level.WARNING, "could not load look and feel", ulafe1); + } + } if (antialias) { System.setProperty("swing.aatext", "true"); } @@ -380,6 +398,9 @@ public class SwingInterface implements CoreListener, LoggingListener { if (configProperties.containsKey("userFont")) { userFont = configProperties.getProperty("userFont"); } + if (configProperties.containsKey("lookAndFeel")) { + lookAndFeel = configProperties.getProperty("lookAndFeel"); + } if (configProperties.containsKey("language")) { I18n.setLocale(new Locale(configProperties.getProperty("language"))); } @@ -410,6 +431,9 @@ public class SwingInterface implements CoreListener, LoggingListener { if (userFont != null) { configProperties.setProperty("userFont", userFont); } + if (lookAndFeel != null) { + configProperties.setProperty("lookAndFeel", lookAndFeel); + } configProperties.setProperty("language", I18n.getLocale().getLanguage()); FileOutputStream configOutputStream = null; try { @@ -571,6 +595,7 @@ public class SwingInterface implements CoreListener, LoggingListener { configurationDialog.setAntialias(antialias); configurationDialog.setControlFont(controlFont); configurationDialog.setUserFont(userFont); + configurationDialog.setLookAndFeel(lookAndFeel); configurationDialog.setVisible(true); if (!configurationDialog.wasCancelled()) { advancedMode = configurationDialog.isAdvancedMode(); @@ -581,6 +606,7 @@ public class SwingInterface implements CoreListener, LoggingListener { antialias = configurationDialog.isAntialias(); controlFont = configurationDialog.getControlFont(); userFont = configurationDialog.getUserFont(); + lookAndFeel = configurationDialog.getLookAndFeel(); saveConfig(); } }