From 546cf81db4bd9193c8e1e688419b88218a091c5a Mon Sep 17 00:00:00 2001 From: ggrandes Date: Tue, 22 Mar 2022 20:28:35 +0100 Subject: [PATCH] gui: update flatlaf/miglayout dependencies [close #3] --- jentunnel-gui/pom.xml | 4 ++-- .../org/javastack/jentunnel/gui/GlobalSettings.java | 12 ++++++------ .../java/org/javastack/jentunnel/gui/Resources.java | 10 +++++----- .../jentunnel/gui/flatlaf/IJThemesPanel.java | 6 +++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/jentunnel-gui/pom.xml b/jentunnel-gui/pom.xml index b3f19de..6fa1f32 100644 --- a/jentunnel-gui/pom.xml +++ b/jentunnel-gui/pom.xml @@ -17,8 +17,8 @@ ${project.basedir}/.. org.javastack.jentunnel.gui.jEnTunnel - 0.40 - 5.2 + 1.6.5 + 5.3 diff --git a/jentunnel-gui/src/main/java/org/javastack/jentunnel/gui/GlobalSettings.java b/jentunnel-gui/src/main/java/org/javastack/jentunnel/gui/GlobalSettings.java index 12a961f..cc1b882 100644 --- a/jentunnel-gui/src/main/java/org/javastack/jentunnel/gui/GlobalSettings.java +++ b/jentunnel-gui/src/main/java/org/javastack/jentunnel/gui/GlobalSettings.java @@ -102,13 +102,13 @@ public static void initLaf() { if (IntelliJTheme.ThemeLaf.class.getName().equals(lafClassName)) { String theme = LAF_THEME.get(); // "" if (theme.startsWith(RESOURCE_PREFIX)) { - IntelliJTheme.install(IJThemesPanel.class.getResourceAsStream( + IntelliJTheme.setup(IJThemesPanel.class.getResourceAsStream( IJThemesPanel.THEMES_PACKAGE + theme.substring(RESOURCE_PREFIX.length()))); } else if (theme.startsWith(FILE_PREFIX)) { - FlatLaf.install(IntelliJTheme + FlatLaf.setup(IntelliJTheme .createLaf(new FileInputStream(theme.substring(FILE_PREFIX.length())))); } else { - FlatDarculaLaf.install(); + FlatDarculaLaf.setup(); } if (!theme.isEmpty()) { UIManager.getLookAndFeelDefaults().put(THEME_UI_KEY.get(), theme); @@ -118,9 +118,9 @@ public static void initLaf() { if (theme.startsWith(FILE_PREFIX)) { File themeFile = new File(theme.substring(FILE_PREFIX.length())); String themeName = StringUtils.removeTrailing(themeFile.getName(), ".properties"); - FlatLaf.install(new FlatPropertiesLaf(themeName, themeFile)); + FlatLaf.setup(new FlatPropertiesLaf(themeName, themeFile)); } else { - FlatDarculaLaf.install(); + FlatDarculaLaf.setup(); } if (!theme.isEmpty()) { UIManager.getLookAndFeelDefaults().put(THEME_UI_KEY.get(), theme); @@ -131,7 +131,7 @@ public static void initLaf() { } catch (Exception e) { log.error("Error loading LAF: {}", String.valueOf(e), e); // fallback - FlatDarculaLaf.install(); + FlatDarculaLaf.setup(); } // Show all Mnemonics UIManager.put("Component.hideMnemonics", false); diff --git a/jentunnel-gui/src/main/java/org/javastack/jentunnel/gui/Resources.java b/jentunnel-gui/src/main/java/org/javastack/jentunnel/gui/Resources.java index fa05278..2520de6 100644 --- a/jentunnel-gui/src/main/java/org/javastack/jentunnel/gui/Resources.java +++ b/jentunnel-gui/src/main/java/org/javastack/jentunnel/gui/Resources.java @@ -10,7 +10,7 @@ import javax.swing.Icon; import javax.swing.ImageIcon; -import com.formdev.flatlaf.extras.SVGUtils; +import com.formdev.flatlaf.extras.FlatSVGUtils; public class Resources { static AppInfo appInfo = AppInfo.getInstance(); @@ -20,7 +20,7 @@ public class Resources { // https://www.materialui.co/flatuicolors // https://fontawesome.com/icons?d=gallery // https://github.com/FortAwesome/Font-Awesome/blob/master/svgs/ - static List mainIcons = SVGUtils.createWindowIconImages("/images/ring.svg"); + static List mainIcons = FlatSVGUtils.createWindowIconImages("/images/ring.svg"); static ImageIcon userIcon = loadIconSVG("/images/user.svg"); static ImageIcon chainIcon = loadIconSVG("/images/chain.svg"); static ImageIcon forwardIcon = loadIconSVG("/images/random.svg"); @@ -91,7 +91,7 @@ public synchronized Throwable fillInStackTrace() { } private static ImageIcon loadIconSVG(final String location) { - final BufferedImage image = SVGUtils.svg2image(location, 1f); // 16 x 16 + final BufferedImage image = FlatSVGUtils.svg2image(location, 1f); // 16 x 16 if (image == null) { throw resourceNotFound(location); } @@ -105,7 +105,7 @@ private static AnimatedIcon loadIconSVG(final String... locations) { private static AnimatedIcon loadIconSVG(final float size, final String... locations) { final ImageIcon[] imgs = new ImageIcon[locations.length]; for (int i = 0; i < locations.length; i++) { - final BufferedImage image = SVGUtils.svg2image(locations[i], size); + final BufferedImage image = FlatSVGUtils.svg2image(locations[i], size); if (image == null) { throw resourceNotFound(locations[i]); } @@ -123,7 +123,7 @@ private static ImageIcon loadIconPNG(final String location) { } private static Image loadImageSVG(final String location) { - final BufferedImage image = SVGUtils.svg2image(location, 1f); // 16 x 16 + final BufferedImage image = FlatSVGUtils.svg2image(location, 1f); // 16 x 16 if (image == null) { throw resourceNotFound(location); } diff --git a/jentunnel-gui/src/main/java/org/javastack/jentunnel/gui/flatlaf/IJThemesPanel.java b/jentunnel-gui/src/main/java/org/javastack/jentunnel/gui/flatlaf/IJThemesPanel.java index f1130cd..769f5ae 100644 --- a/jentunnel-gui/src/main/java/org/javastack/jentunnel/gui/flatlaf/IJThemesPanel.java +++ b/jentunnel-gui/src/main/java/org/javastack/jentunnel/gui/flatlaf/IJThemesPanel.java @@ -254,9 +254,9 @@ private void setTheme(IJThemeInfo themeInfo) { } else if (themeInfo.themeFile != null) { try { if (themeInfo.themeFile.getName().endsWith(".properties")) { - FlatLaf.install(new FlatPropertiesLaf(themeInfo.name, themeInfo.themeFile)); + FlatLaf.setup(new FlatPropertiesLaf(themeInfo.name, themeInfo.themeFile)); } else { - FlatLaf.install(IntelliJTheme.createLaf(new FileInputStream(themeInfo.themeFile))); + FlatLaf.setup(IntelliJTheme.createLaf(new FileInputStream(themeInfo.themeFile))); } GlobalSettings.LAF_THEME.set(GlobalSettings.FILE_PREFIX + themeInfo.themeFile); } catch (Exception ex) { @@ -264,7 +264,7 @@ private void setTheme(IJThemeInfo themeInfo) { showInformationDialog("Failed to load '" + themeInfo.themeFile + "'.", ex); } } else { - IntelliJTheme.install(getClass().getResourceAsStream(THEMES_PACKAGE + themeInfo.resourceName)); + IntelliJTheme.setup(getClass().getResourceAsStream(THEMES_PACKAGE + themeInfo.resourceName)); GlobalSettings.LAF_THEME.set(GlobalSettings.RESOURCE_PREFIX + themeInfo.resourceName); }