Added isDefaultLookAndFeel()

This commit is contained in:
nathan 2017-07-11 14:14:59 +02:00
parent 247827ec75
commit 73163b769e

View File

@ -89,8 +89,6 @@ class SwingUtil {
void setLookAndFeelByName(final String lookAndFeel) {
if (lookAndFeel == null) {
try {
// NOTE: On Linux + swing if the SystemLookAndFeel is the GtkLookAndFeel, this will cause GTK2 to get loaded first, which
// will cause conflicts if one tries to ALSO use GTK3
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
e.printStackTrace();
@ -160,6 +158,17 @@ class SwingUtil {
new Exception("Could not load " + lookAndFeel + ", it was not available.").printStackTrace();
}
/**
* @return true if the System is configured to use the System L&F. False otherwise
*/
public static
boolean isDefaultLookAndFeel() {
return UIManager.getLookAndFeel()
.getClass()
.getName()
.equals(UIManager.getSystemLookAndFeelClassName());
}
/** used when setting various icon components in the GUI to "nothing", since null doesn't work */
public static final Image BLANK_ICON = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB_PRE);