Package generic.theme.laf
Class LookAndFeelManager
java.lang.Object
generic.theme.laf.LookAndFeelManager
- Direct Known Subclasses:
FlatLookAndFeelManager,GtkLookAndFeelManager,MacLookAndFeelManager,MetalLookAndFeelManager,MotifLookAndFeelManager,NimbusLookAndFeelManager,WindowsClassicLookAndFeelManager,WindowsLookAndFeelManager
Manages installing and updating a
LookAndFeel-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedLookAndFeelManager(LafType laf, ApplicationThemeManager themeManager) -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled when one or more colors have changed.protected voidSubclasses may override this method to install a specific look and feel.protected StringfindLookAndFeelClassName(String lookAndFeelName) protected voidSubclass may override this method to do specific LookAndFeel fix upsvoidfontsChanged(Set<String> changedJavaFontIds) 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 theLafTypemanaged by this manager.protected abstract UiDefaultsMappergetUiDefaultsMapper(UIDefaults defaults) voidiconsChanged(Set<String> changedIconIds, Icon newIcon) Called when one or more icons have changed.voidInstalls theLookAndFeelprotected booleanisSupported(String lookAndFeelName) protected voidExtracts java default colors, fonts, and icons and stores them in theThemeManagerand updates theUIDefaultsby installing GColors for all color values and installing any overridden fonts or icons.voidregisterFont(Component component, String fontId) Binds the component to the font identified by the given font id.protected voidvoidresetAll(GThemeValueMap javaDefaults) Called when all colors, fonts, and icons may have changedprotected voidsetKeyBinding(String existingKsText, String newKsText, String[] prefixValues) protected voidprotected void
-
Field Details
-
themeManager
-
normalizedIdToLafIdMap
-
-
Constructor Details
-
LookAndFeelManager
-
-
Method Details
-
getLookAndFeelType
Returns theLafTypemanaged by this manager.- Returns:
- the
LafType
-
installLookAndFeel
public void installLookAndFeel() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelExceptionInstalls theLookAndFeel- Throws:
ClassNotFoundException- if theLookAndFeelclass 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.- Parameters:
changedJavaFontIds- the set of Java Font ids that are affected by this change
-
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
-
doInstallLookAndFeel
protected void doInstallLookAndFeel() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelExceptionSubclasses may override this method to install a specific look and feel.- Throws:
ClassNotFoundException- if theLookAndFeelclass 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 fix ups -
processJavaDefaults
protected void processJavaDefaults()Extracts java default colors, fonts, and icons and stores them in theThemeManagerand updates theUIDefaultsby installing GColors for all color values and installing any overridden fonts or icons. -
getUiDefaultsMapper
-
findLookAndFeelClassName
-
isSupported
-
setKeyBinding
-
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.
-