Skip to content

Commit

Permalink
Remove jgoodies look & feel themes
Browse files Browse the repository at this point in the history
  • Loading branch information
Borewit committed Apr 2, 2023
1 parent 5df3e7a commit 53baf16
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 160 deletions.
6 changes: 0 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,6 @@ dependencies {
// Provides christophedelory.playlist.*
implementation 'io.github.borewit:lizzy:2.0.0'

// https://mvnrepository.com/artifact/com.jgoodies/jgoodies-common
implementation 'com.jgoodies:jgoodies-common:1.8.1'

// https://mvnrepository.com/artifact/com.jgoodies/jgoodies-looks
implementation 'com.jgoodies:jgoodies-looks:2.7.0'

// https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core
implementation 'org.apache.logging.log4j:log4j-core:2.20.0'

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/listfix/config/IAppOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public interface IAppOptions extends IPlaylistOptions

String getLookAndFeel();

void setLookAndFeel(String lookAndFeelClassName);

boolean getAutoRefreshMediaLibraryOnStartup();

String getPlaylistsDirectory();
Expand Down
5 changes: 1 addition & 4 deletions src/main/java/listfix/json/JsonAppOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.jgoodies.looks.windows.WindowsLookAndFeel;
import listfix.config.IAppOptions;
import listfix.config.IApplicationState;
import listfix.io.Constants;
import listfix.io.IPlaylistOptions;
import listfix.util.OperatingSystem;

import javax.swing.*;
import java.awt.*;
Expand All @@ -22,8 +20,7 @@ public class JsonAppOptions implements IPlaylistOptions, IAppOptions
private boolean autoRefreshMediaLibraryOnStartup = false;
private boolean alwaysUseUNCPaths = false;
private int maxPlaylistHistoryEntries = 5;
private String lookAndFeel = OperatingSystem.isWindows() ? WindowsLookAndFeel.class.getName() : UIManager.getSystemLookAndFeelClassName();

private String lookAndFeel = UIManager.getSystemLookAndFeelClassName();

@Deprecated // Replaced by playlistDirectories
private String playlistsDirectory;
Expand Down
44 changes: 15 additions & 29 deletions src/main/java/listfix/view/GUIScreen.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
package listfix.view;

import com.jcabi.manifests.Manifests;
import com.jgoodies.looks.plastic.PlasticLookAndFeel;
import com.jgoodies.looks.plastic.theme.DarkStar;
import com.jgoodies.looks.plastic.theme.LightGray;
import com.jgoodies.looks.plastic.theme.SkyBlue;
import io.github.borewit.lizzy.playlist.PlaylistFormat;
import listfix.config.*;
import listfix.controller.ListFixController;
Expand Down Expand Up @@ -121,6 +117,20 @@ private void postInitComponents()
// Set the user-selected font and look & feel
final IAppOptions appConfig = this.getApplicationConfig();
setApplicationFont(appConfig.getAppFont());

if (appConfig.getLookAndFeel() == null || appConfig.getLookAndFeel().isEmpty())
{
appConfig.setLookAndFeel(
Arrays.stream(UIManager.getInstalledLookAndFeels())
.filter(laf -> laf.getName().equals("Nimbus"))
.map(laf -> laf.getClassName())
.findFirst()
.orElse(UIManager.getSystemLookAndFeelClassName()
)
);
_logger.info("Initialize default look & feel to " + appConfig.getLookAndFeel());
}

this.setLookAndFeel(appConfig.getLookAndFeel());

configureFileAndFolderChoosers();
Expand Down Expand Up @@ -2416,31 +2426,7 @@ private void setLookAndFeel(String className)
{
try
{
String realClassName = className;
if (className.equalsIgnoreCase("com.jgoodies.looks.plastic.theme.DarkStar"))
{
PlasticLookAndFeel.setPlasticTheme(new DarkStar());
realClassName = "com.jgoodies.looks.plastic.PlasticLookAndFeel";
}
else if (className.equals("com.jgoodies.looks.plastic.theme.SkyBlue"))
{
PlasticLookAndFeel.setPlasticTheme(new SkyBlue());
realClassName = "com.jgoodies.looks.plastic.PlasticLookAndFeel";
}
else if (className.equalsIgnoreCase("com.jgoodies.looks.plastic.PlasticLookAndFeel"))
{
PlasticLookAndFeel.setPlasticTheme(new LightGray());
}
else if (className.equalsIgnoreCase("com.jgoodies.looks.plastic.Plastic3DLookAndFeel"))
{
PlasticLookAndFeel.setPlasticTheme(new LightGray());
}
else if (className.equalsIgnoreCase("com.jgoodies.looks.plastic.PlasticXPLookAndFeel"))
{
PlasticLookAndFeel.setPlasticTheme(new LightGray());
}

UIManager.setLookAndFeel(realClassName);
UIManager.setLookAndFeel(className);
updateAllComponentTreeUIs();
}
catch (ClassNotFoundException | InstantiationException | IllegalAccessException |
Expand Down
Loading

0 comments on commit 53baf16

Please sign in to comment.