public interface LookAndFeelEnabler
Provides and enables a
LookAndFeel implementation.-
Method Summary
Modifier and TypeMethodDescriptionbooleandark()default UIDefaultsdefaults()voidenable()Configures and enables theLookAndFeelrepresented by this enabler.static voidenableLookAndFeel(String userPreferencePropertyName) Enables the look and feel specified by the given user preference or the default system look and feel if no preference value is found.static booleanenableLookAndFeel(String userPreferencePropertyName, Class<? extends LookAndFeel> defaultLookAndFeel) Enables the look and feel specified by the given user preference or the default one if no preference value is found.static booleanenableLookAndFeel(String userPreferencePropertyName, String defaultLookAndFeel) Enables the look and feel specified by the given user preference or the default one if no preference value is found.static LookAndFeelEnablerlookAndFeelEnabler(UIManager.LookAndFeelInfo lookAndFeelInfo) Instantiates a newLookAndFeelEnabler, usingUIManager.setLookAndFeel(String)to enable.static LookAndFeelEnablerlookAndFeelEnabler(UIManager.LookAndFeelInfo lookAndFeelInfo, boolean dark, Consumer<UIManager.LookAndFeelInfo> enabler) Instantiates a newLookAndFeelEnabler.static LookAndFeelEnablerlookAndFeelEnabler(UIManager.LookAndFeelInfo lookAndFeelInfo, Consumer<UIManager.LookAndFeelInfo> enabler) Instantiates a newLookAndFeelEnabler.booleanplatform()Whether this is one of the platform look and feels provided byUIManager.getInstalledLookAndFeels(), as opposed to one registered viaLookAndFeelProvider.static StringNote that GTKLookAndFeel is overridden with MetalLookAndFeel, since JTabbedPane does not respect the 'TabbedPane.contentBorderInsets' setting, making hierachical tabbed panes look bad
-
Method Details
-
lookAndFeelInfo
UIManager.LookAndFeelInfo lookAndFeelInfo()- Returns:
- the look and feel info
-
enable
void enable()Configures and enables theLookAndFeelrepresented by this enabler. -
lookAndFeel
LookAndFeel lookAndFeel()- Returns:
- a new instance of the
LookAndFeelrepresented by this enabler - Throws:
RuntimeException- in case the class is not found or if theLookAndFeelcould not be instantiated
-
dark
boolean dark()- Returns:
- true if this enabler represents a dark look and feel
-
platform
boolean platform()Whether this is one of the platform look and feels provided byUIManager.getInstalledLookAndFeels(), as opposed to one registered viaLookAndFeelProvider. Determined when the enabler is created.- Returns:
- true if this represents a platform look and feel
-
defaults
- Returns:
- the
UIDefaultsfor the look and feel this enabler represents
-
lookAndFeelEnabler
Instantiates a newLookAndFeelEnabler, usingUIManager.setLookAndFeel(String)to enable.- Parameters:
lookAndFeelInfo- the look and feel info- Returns:
- a look and feel provider
-
lookAndFeelEnabler
static LookAndFeelEnabler lookAndFeelEnabler(UIManager.LookAndFeelInfo lookAndFeelInfo, Consumer<UIManager.LookAndFeelInfo> enabler) Instantiates a newLookAndFeelEnabler.The
enableris responsible for configuring and enabling the look and feel as well as updating the component tree of all application windows, for example by callingUtilities.updateComponentTreeForAllWindows()- Parameters:
lookAndFeelInfo- the look and feel infoenabler- configures and enables the look and feel as well as updates the component tree of all application windows- Returns:
- a look and feel provider
-
lookAndFeelEnabler
static LookAndFeelEnabler lookAndFeelEnabler(UIManager.LookAndFeelInfo lookAndFeelInfo, boolean dark, Consumer<UIManager.LookAndFeelInfo> enabler) Instantiates a newLookAndFeelEnabler.The
enableris responsible for configuring and enabling the look and feel as well as updating the component tree of all application windows, for example by callingUtilities.updateComponentTreeForAllWindows()- Parameters:
lookAndFeelInfo- the look and feel infodark- true if the resulting enabler should represent a dark look and feelenabler- configures and enables the look and feel as well as updates the component tree of all application windows- Returns:
- a look and feel provider
-
enableLookAndFeel
Enables the look and feel specified by the given user preference or the default system look and feel if no preference value is found.- Parameters:
userPreferencePropertyName- the name of the user preference look and feel property
-
enableLookAndFeel
static boolean enableLookAndFeel(String userPreferencePropertyName, Class<? extends LookAndFeel> defaultLookAndFeel) Enables the look and feel specified by the given user preference or the default one if no preference value is found.- Parameters:
userPreferencePropertyName- the name of the user preference look and feel propertydefaultLookAndFeel- the default look and feel class to use if none is found in user preferences- Returns:
- true if a look and feel was enabled, false if the neither the user preference nor default look and feels were available
-
enableLookAndFeel
Enables the look and feel specified by the given user preference or the default one if no preference value is found.- Parameters:
userPreferencePropertyName- the name of the user preference look and feel propertydefaultLookAndFeel- the classname of the default look and feel to use if none is found in user preferences- Returns:
- true if a look and feel was enabled, false if the neither the user preference nor default look and feels were available
-
systemLookAndFeelClassName
Note that GTKLookAndFeel is overridden with MetalLookAndFeel, since JTabbedPane does not respect the 'TabbedPane.contentBorderInsets' setting, making hierachical tabbed panes look bad- Returns:
- the default look and feel for the platform we're running on
-