diff --git a/lib/jide-oss.jar b/lib/jide-oss.jar index 4c991f6..e9e5325 100644 Binary files a/lib/jide-oss.jar and b/lib/jide-oss.jar differ diff --git a/src/com/gpl/rpg/atcontentstudio/ATContentStudio.java b/src/com/gpl/rpg/atcontentstudio/ATContentStudio.java index 8bb3fc3..87be333 100644 --- a/src/com/gpl/rpg/atcontentstudio/ATContentStudio.java +++ b/src/com/gpl/rpg/atcontentstudio/ATContentStudio.java @@ -65,22 +65,8 @@ public class ATContentStudio { ConfigCache.init(); - try { - String laf = ConfigCache.getFavoriteLaFClassName(); - if (laf == null) - laf = UIManager.getSystemLookAndFeelClassName(); - UIManager.setLookAndFeel(laf); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } catch (InstantiationException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } catch (UnsupportedLookAndFeelException e) { - e.printStackTrace(); - } - - scaleUIFont(); + String laf = ConfigCache.getFavoriteLaFClassName(); + setLookAndFeel(laf); // Need to keep a strong reference to it, to avoid garbage collection that'll // reset this setting. @@ -116,7 +102,6 @@ public class ATContentStudio { frame.setVisible(true); frame.setDefaultCloseOperation(StudioFrame.DO_NOTHING_ON_CLOSE); } - }); for (File f : ConfigCache.getKnownWorkspaces()) { if (workspaceRoot.equals(f)) { @@ -134,6 +119,34 @@ public class ATContentStudio { }); } + public static void setLookAndFeel(String laf) { + if (laf == null) + { + System.out.println("No look and feel specified, using system default."); + laf = UIManager.getSystemLookAndFeelClassName(); + } + System.out.println("Info: Setting look and feel to: " + laf); + + try { + UIManager.setLookAndFeel(laf); + } catch (ClassNotFoundException e) { + System.err.println("Failed to load system look and feel. "); + System.err.println("Installed look and feel classes: "); + for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { + System.err.println(" " + info.getName() + " (" + info.getClassName() + ")"); + } + System.err.println("Tried to load: " + laf + " but got this error:"); + + e.printStackTrace(); + } catch (InstantiationException | UnsupportedLookAndFeelException | IllegalAccessException e) { + e.printStackTrace(); + } + var newLaF = UIManager.getLookAndFeel(); + System.out.println("Using look and feel: " + newLaF.getName() + " (" + newLaF.getClass().getName() + ")"); + + scaleUIFont(); + } + private static void checkUpdate() { BufferedReader in = null; try { @@ -156,13 +169,13 @@ public class ATContentStudio { style.append("font-weight:" + (font.isBold() ? "bold" : "normal") + ";"); style.append("font-size:" + font.getSize() + "pt;"); style.append("background-color: rgb(" + color.getRed() + "," + color.getGreen() + "," + color.getBlue() - + ");"); + + ");"); JEditorPane ep = new JEditorPane("text/html", - "" + "You are not running the latest ATCS version.
" - + "You can get the latest version (" + lastLine + ") by clicking the link below.
" - + "" + DOWNLOAD_URL + "
" + "
" - + ""); + "" + "You are not running the latest ATCS version.
" + + "You can get the latest version (" + lastLine + ") by clicking the link below.
" + + "" + DOWNLOAD_URL + "
" + "
" + + ""); ep.setEditable(false); ep.setBorder(null); diff --git a/src/com/gpl/rpg/atcontentstudio/ui/StudioFrame.java b/src/com/gpl/rpg/atcontentstudio/ui/StudioFrame.java index 009d790..68bf70d 100644 --- a/src/com/gpl/rpg/atcontentstudio/ui/StudioFrame.java +++ b/src/com/gpl/rpg/atcontentstudio/ui/StudioFrame.java @@ -145,20 +145,10 @@ public class StudioFrame extends JFrame { lafItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - try { - UIManager.setLookAndFeel(i.getClassName()); - ATContentStudio.scaleUIFont(); - SwingUtilities.updateComponentTreeUI(ATContentStudio.frame); - ConfigCache.setFavoriteLaFClassName(i.getClassName()); - } catch (ClassNotFoundException e1) { - e1.printStackTrace(); - } catch (InstantiationException e1) { - e1.printStackTrace(); - } catch (IllegalAccessException e1) { - e1.printStackTrace(); - } catch (UnsupportedLookAndFeelException e1) { - e1.printStackTrace(); - } + String lookAndFeel = i.getClassName(); + ATContentStudio.setLookAndFeel(lookAndFeel); + SwingUtilities.updateComponentTreeUI(ATContentStudio.frame); + ConfigCache.setFavoriteLaFClassName(lookAndFeel); } }); } @@ -231,5 +221,4 @@ public class StudioFrame extends JFrame { editors.showAbout(); } - }