Skip to content

Commit 53baf16

Browse files
committed
Remove jgoodies look & feel themes
1 parent 5df3e7a commit 53baf16

File tree

5 files changed

+63
-160
lines changed

5 files changed

+63
-160
lines changed

build.gradle

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,6 @@ dependencies {
9797
// Provides christophedelory.playlist.*
9898
implementation 'io.github.borewit:lizzy:2.0.0'
9999

100-
// https://mvnrepository.com/artifact/com.jgoodies/jgoodies-common
101-
implementation 'com.jgoodies:jgoodies-common:1.8.1'
102-
103-
// https://mvnrepository.com/artifact/com.jgoodies/jgoodies-looks
104-
implementation 'com.jgoodies:jgoodies-looks:2.7.0'
105-
106100
// https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core
107101
implementation 'org.apache.logging.log4j:log4j-core:2.20.0'
108102

src/main/java/listfix/config/IAppOptions.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ public interface IAppOptions extends IPlaylistOptions
1212

1313
String getLookAndFeel();
1414

15+
void setLookAndFeel(String lookAndFeelClassName);
16+
1517
boolean getAutoRefreshMediaLibraryOnStartup();
1618

1719
String getPlaylistsDirectory();

src/main/java/listfix/json/JsonAppOptions.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22

33
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
44
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
5-
import com.jgoodies.looks.windows.WindowsLookAndFeel;
65
import listfix.config.IAppOptions;
76
import listfix.config.IApplicationState;
87
import listfix.io.Constants;
98
import listfix.io.IPlaylistOptions;
10-
import listfix.util.OperatingSystem;
119

1210
import javax.swing.*;
1311
import java.awt.*;
@@ -22,8 +20,7 @@ public class JsonAppOptions implements IPlaylistOptions, IAppOptions
2220
private boolean autoRefreshMediaLibraryOnStartup = false;
2321
private boolean alwaysUseUNCPaths = false;
2422
private int maxPlaylistHistoryEntries = 5;
25-
private String lookAndFeel = OperatingSystem.isWindows() ? WindowsLookAndFeel.class.getName() : UIManager.getSystemLookAndFeelClassName();
26-
23+
private String lookAndFeel = UIManager.getSystemLookAndFeelClassName();
2724

2825
@Deprecated // Replaced by playlistDirectories
2926
private String playlistsDirectory;

src/main/java/listfix/view/GUIScreen.java

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
package listfix.view;
22

33
import com.jcabi.manifests.Manifests;
4-
import com.jgoodies.looks.plastic.PlasticLookAndFeel;
5-
import com.jgoodies.looks.plastic.theme.DarkStar;
6-
import com.jgoodies.looks.plastic.theme.LightGray;
7-
import com.jgoodies.looks.plastic.theme.SkyBlue;
84
import io.github.borewit.lizzy.playlist.PlaylistFormat;
95
import listfix.config.*;
106
import listfix.controller.ListFixController;
@@ -121,6 +117,20 @@ private void postInitComponents()
121117
// Set the user-selected font and look & feel
122118
final IAppOptions appConfig = this.getApplicationConfig();
123119
setApplicationFont(appConfig.getAppFont());
120+
121+
if (appConfig.getLookAndFeel() == null || appConfig.getLookAndFeel().isEmpty())
122+
{
123+
appConfig.setLookAndFeel(
124+
Arrays.stream(UIManager.getInstalledLookAndFeels())
125+
.filter(laf -> laf.getName().equals("Nimbus"))
126+
.map(laf -> laf.getClassName())
127+
.findFirst()
128+
.orElse(UIManager.getSystemLookAndFeelClassName()
129+
)
130+
);
131+
_logger.info("Initialize default look & feel to " + appConfig.getLookAndFeel());
132+
}
133+
124134
this.setLookAndFeel(appConfig.getLookAndFeel());
125135

126136
configureFileAndFolderChoosers();
@@ -2416,31 +2426,7 @@ private void setLookAndFeel(String className)
24162426
{
24172427
try
24182428
{
2419-
String realClassName = className;
2420-
if (className.equalsIgnoreCase("com.jgoodies.looks.plastic.theme.DarkStar"))
2421-
{
2422-
PlasticLookAndFeel.setPlasticTheme(new DarkStar());
2423-
realClassName = "com.jgoodies.looks.plastic.PlasticLookAndFeel";
2424-
}
2425-
else if (className.equals("com.jgoodies.looks.plastic.theme.SkyBlue"))
2426-
{
2427-
PlasticLookAndFeel.setPlasticTheme(new SkyBlue());
2428-
realClassName = "com.jgoodies.looks.plastic.PlasticLookAndFeel";
2429-
}
2430-
else if (className.equalsIgnoreCase("com.jgoodies.looks.plastic.PlasticLookAndFeel"))
2431-
{
2432-
PlasticLookAndFeel.setPlasticTheme(new LightGray());
2433-
}
2434-
else if (className.equalsIgnoreCase("com.jgoodies.looks.plastic.Plastic3DLookAndFeel"))
2435-
{
2436-
PlasticLookAndFeel.setPlasticTheme(new LightGray());
2437-
}
2438-
else if (className.equalsIgnoreCase("com.jgoodies.looks.plastic.PlasticXPLookAndFeel"))
2439-
{
2440-
PlasticLookAndFeel.setPlasticTheme(new LightGray());
2441-
}
2442-
2443-
UIManager.setLookAndFeel(realClassName);
2429+
UIManager.setLookAndFeel(className);
24442430
updateAllComponentTreeUIs();
24452431
}
24462432
catch (ClassNotFoundException | InstantiationException | IllegalAccessException |

0 commit comments

Comments
 (0)