Module is.codion.swing.common.ui
Package is.codion.swing.common.ui.laf
Interface LookAndFeelProvider
public interface LookAndFeelProvider
Provides a LookAndFeel implementation.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final PropertyValue<Boolean>
Specifies whether the cross platform Look and Feel should be available for selection.static final PropertyValue<Boolean>
Specifies whether the cross platform Look and Feel should be available for selection. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addLookAndFeel
(LookAndFeelProvider lookAndFeelProvider) Adds the given look and feel provider.static void
addLookAndFeel
(UIManager.LookAndFeelInfo lookAndFeelInfo) Adds a new look and feel provider.static void
addLookAndFeel
(UIManager.LookAndFeelInfo lookAndFeelInfo, Consumer<UIManager.LookAndFeelInfo> enabler) Adds a new look and feel provider.static String
defaultLookAndFeelName
(String userPreferencePropertyName) Returns the look and feel specified by the given user preference or the system look and feel if no preference value is found.static String
defaultLookAndFeelName
(String userPreferencePropertyName, String defaultLookAndFeel) Returns the look and feel specified by the given user preference or the system look and feel if no preference value is found.void
enable()
Configures and enables this LookAndFeel.static void
enableLookAndFeel
(LookAndFeelProvider lookAndFeelProvider) Enables the given look and feel and updates all window component trees.static Optional<LookAndFeelProvider>
findLookAndFeelProvider
(String className) Returns a look and feel provider with the given classname, if availablestatic LookAndFeelProvider
lookAndFeelProvider
(UIManager.LookAndFeelInfo lookAndFeelInfo) Instantiates a new LookAndFeelProvider, usingUIManager.setLookAndFeel(String)
to enable.static LookAndFeelProvider
lookAndFeelProvider
(UIManager.LookAndFeelInfo lookAndFeelInfo, Consumer<UIManager.LookAndFeelInfo> enabler) Instantiates a new LookAndFeelProvider.static Map<String,
LookAndFeelProvider>
-
Field Details
-
CROSS_PLATFORM
Specifies whether the cross platform Look and Feel should be available for selection.- Value type: Boolean
- Default value: true
-
SYSTEM
Specifies whether the cross platform Look and Feel should be available for selection.- Value type: Boolean
- Default value: true
-
-
Method Details
-
lookAndFeelInfo
UIManager.LookAndFeelInfo lookAndFeelInfo()- Returns:
- the look and feel info
-
enable
void enable()Configures and enables this LookAndFeel. -
lookAndFeel
LookAndFeel lookAndFeel()- Returns:
- an instance of the
LookAndFeel
represented by this provider - Throws:
RuntimeException
- in case the class is not found or if theLookAndFeel
could not be instantiated
-
lookAndFeelProvider
Instantiates a new LookAndFeelProvider, usingUIManager.setLookAndFeel(String)
to enable.- Parameters:
lookAndFeelInfo
- the look and feel info- Returns:
- a look and feel provider
-
lookAndFeelProvider
static LookAndFeelProvider lookAndFeelProvider(UIManager.LookAndFeelInfo lookAndFeelInfo, Consumer<UIManager.LookAndFeelInfo> enabler) Instantiates a new LookAndFeelProvider.- Parameters:
lookAndFeelInfo
- the look and feel infoenabler
- configures and enables this look and feel- Returns:
- a look and feel provider
-
addLookAndFeel
Adds a new look and feel provider.- Parameters:
lookAndFeelInfo
- the look and feel info
-
addLookAndFeel
static void addLookAndFeel(UIManager.LookAndFeelInfo lookAndFeelInfo, Consumer<UIManager.LookAndFeelInfo> enabler) Adds a new look and feel provider.- Parameters:
lookAndFeelInfo
- the look and feel infoenabler
- configures and enables this look and feel
-
addLookAndFeel
Adds the given look and feel provider. Note that this replaces any existing look and feel provider based on the same classname.- Parameters:
lookAndFeelProvider
- the look and feel provider to add
-
lookAndFeelProviders
- Returns:
- the available
LookAndFeelProvider
s - See Also:
-
findLookAndFeelProvider
Returns a look and feel provider with the given classname, if available- Parameters:
className
- the look and feel classname- Returns:
- a look and feel provider, an empty Optional if not found
-
defaultLookAndFeelName
Returns the look and feel specified by the given user preference or the system look and feel if no preference value is found.- Parameters:
userPreferencePropertyName
- the name of the user preference look and feel property- Returns:
- the look and feel specified by user preference or the default system look and feel
-
defaultLookAndFeelName
Returns the look and feel specified by the given user preference or the system look and feel if no preference value is found.- Parameters:
userPreferencePropertyName
- the name of the user preference look and feel propertydefaultLookAndFeel
- the default look and feel to use if none is found in user preferences- Returns:
- the look and feel specified by user preference or the default system look and feel
-
enableLookAndFeel
Enables the given look and feel and updates all window component trees.- Parameters:
lookAndFeelProvider
- the look and feel provider to enable
-