Class LookAndFeelManager
- Direct Known Subclasses:
FlatLookAndFeelManager
,GtkLookAndFeelManager
,MacLookAndFeelManager
,MetalLookAndFeelManager
,MotifLookAndFeelManager
,NimbusLookAndFeelManager
,WindowsClassicLookAndFeelManager
,WindowsLookAndFeelManager
LookAndFeel
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
LookAndFeelManager
(LafType laf, ApplicationThemeManager themeManager) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Called when one or more colors have changed.protected abstract UiDefaultsMapper
createUiDefaultsMapper
(UIDefaults defaults) protected void
Subclasses may override this method to install a specific look and feel.protected String
findLookAndFeelClassName
(String lookAndFeelName) protected void
Subclass may override this method to do specific LookAndFeel fixes.void
fontsChanged
(Set<String> changedFontIds) Called when one or more fonts have changed.getLookAndFeelIdsForType
(UIDefaults defaults, Class<?> clazz) Searches the given UIDefaults for ids whose value matches the given classReturns theLafType
managed by this manager.void
iconsChanged
(Set<String> changedIconIds, Icon newIcon) Called when one or more icons have changed.void
void
Installs theLookAndFeel
protected boolean
isSupported
(String lookAndFeelName) protected void
Extracts java default colors, fonts, and icons and stores them in theThemeManager
and updates theUIDefaults
by installing GColors for all color values and installing any overridden fonts or icons.void
registerFont
(Component component, String fontId) Binds the component to the font identified by the given font id.void
registerFont
(Component component, String fontId, int fontStyle) Binds the component to the font identified by the given font id.protected void
void
resetAll
(GThemeValueMap javaDefaults) Called when all colors, fonts, and icons may have changedprotected void
setKeyBinding
(String existingKsText, String newKsText, String[] prefixValues) void
unRegisterFont
(JComponent component, String fontId) Removes the given component and id binding from this class.protected void
protected void
-
Field Details
-
themeManager
-
normalizedIdToLafIdMap
-
-
Constructor Details
-
LookAndFeelManager
-
-
Method Details
-
getLookAndFeelType
Returns theLafType
managed by this manager.- Returns:
- the
LafType
-
installLookAndFeel
public void installLookAndFeel() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelExceptionInstalls theLookAndFeel
- Throws:
ClassNotFoundException
- if theLookAndFeel
class could not be foundInstantiationException
- if a new instance of the class couldn't be createdIllegalAccessException
- if the class or initializer isn't accessibleUnsupportedLookAndFeelException
- iflnf.isSupportedLookAndFeel()
is false
-
resetAll
Called when all colors, fonts, and icons may have changed- Parameters:
javaDefaults
- the current set of java defaults so that those ids can be updated special as needed by the currentLookAndFeel
-
updateAllRegisteredComponentFonts
protected void updateAllRegisteredComponentFonts() -
colorsChanged
public void colorsChanged()Called when one or more colors have changed. -
iconsChanged
Called when one or more icons have changed.- Parameters:
changedIconIds
- set of icon ids affected by this icon changenewIcon
- the new icon to use for the given set of icon ids
-
fontsChanged
Called when one or more fonts have changed.This will update the Java
UIManager
and trigger a reload of the UIs.- Parameters:
changedFontIds
- the set of Java Font ids that are affected by this change; these are the normalized ids
-
updateComponentUis
protected void updateComponentUis() -
repaintAll
protected void repaintAll() -
registerFont
Binds the component to the font identified by the given font id. Whenever the font for the font id changes, the component will be updated with the new font.- Parameters:
component
- the component to set/update the fontfontId
- the id of the font to register with the given component
-
registerFont
Binds the component to the font identified by the given font id. Whenever the font for the font id changes, the component will be updated with the new font.This method is fairly niche and should not be called by most clients. Instead, call
registerFont(Component, String)
.- Parameters:
component
- the component to set/update the fontfontId
- the id of the font to register with the given componentfontStyle
- the font style
-
unRegisterFont
Removes the given component and id binding from this class.- Parameters:
component
- the component to removefontId
- the id used when originally registered- See Also:
-
doInstallLookAndFeel
protected void doInstallLookAndFeel() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelExceptionSubclasses may override this method to install a specific look and feel.- Throws:
ClassNotFoundException
- if theLookAndFeel
class could not be foundInstantiationException
- if a new instance of the class couldn't be createdIllegalAccessException
- if the class or initializer isn't accessibleUnsupportedLookAndFeelException
- iflnf.isSupportedLookAndFeel()
is false
-
fixupLookAndFeelIssues
protected void fixupLookAndFeelIssues()Subclass may override this method to do specific LookAndFeel fixes.This will get called after default values are loaded. This means that any values installed by this method will overwrite any values registered by the theme.
Standard properties, such as strings and booleans, can be set inside of the theme properties files. For more complicated UIManager properties, look and feel classes will need to override this method and install those directly.
Any property installed here will not fully be part of the theme system, but rather will be directly installed into the Java Look and Feel. Thus, properties installed here will be hard-coded overrides for the system. If we decided that a hard-coded value should be put into the theme system, then we will need to add support for that property type so that it can be used when loading the theme files.
-
processJavaDefaults
protected void processJavaDefaults()Extracts java default colors, fonts, and icons and stores them in theThemeManager
and updates theUIDefaults
by installing GColors for all color values and installing any overridden fonts or icons. -
createUiDefaultsMapper
-
findLookAndFeelClassName
-
isSupported
-
setKeyBinding
-
installCursorBlinkingProperties
public void installCursorBlinkingProperties() -
getLookAndFeelIdsForType
Searches the given UIDefaults for ids whose value matches the given class- Parameters:
defaults
- the UIDefaults to searchclazz
- the value class to look for (i.e., Color, Font, or Icon)- Returns:
- the list of ids whose value is of the given class type.
-