Skip to content

Commit

Permalink
gui: update flatlaf/miglayout dependencies [close #3]
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrandes committed Mar 22, 2022
1 parent cae3795 commit 546cf81
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions jentunnel-gui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
<properties>
<projectRoot>${project.basedir}/..</projectRoot>
<start-class>org.javastack.jentunnel.gui.jEnTunnel</start-class>
<flatlaf.version>0.40</flatlaf.version>
<miglayout.version>5.2</miglayout.version>
<flatlaf.version>1.6.5</flatlaf.version>
<miglayout.version>5.3</miglayout.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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<Image> mainIcons = SVGUtils.createWindowIconImages("/images/ring.svg");
static List<Image> 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");
Expand Down Expand Up @@ -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);
}
Expand All @@ -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]);
}
Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,17 +254,17 @@ 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) {
ex.printStackTrace();
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);
}

Expand Down

0 comments on commit 546cf81

Please sign in to comment.