- java.lang.Object
-
- javax.swing.plaf.metal.MetalTheme
-
- Direct Known Subclasses:
- DefaultMetalTheme
public abstract class MetalTheme extends Object
MetalTheme
provides the color palette and fonts used by the Java Look and Feel.MetalTheme
is abstract, seeDefaultMetalTheme
andOceanTheme
for concrete implementations.MetalLookAndFeel
maintains the current theme that the theComponentUI
implementations for metal use. Refer toMetalLookAndFeel.setCurrentTheme(MetalTheme)
for details on changing the current theme.MetalTheme
provides a number of public methods for getting colors. These methods are implemented in terms of a handful of protected abstract methods. A subclass need only override the protected abstract methods (getPrimary1
,getPrimary2
,getPrimary3
,getSecondary1
,getSecondary2
, andgetSecondary3
); although a subclass may override the other public methods for more control over the set of colors that are used.Concrete implementations of
MetalTheme
must returnnon-null
values from all methods. While the behavior of returningnull
is not specified, returningnull
will result in incorrect behavior.It is strongly recommended that subclasses return completely opaque colors. To do otherwise may result in rendering problems, such as visual garbage.
-
-
Constructor Summary
Constructors Constructor and Description MetalTheme()
-
Method Summary
Methods Modifier and Type Method and Description void
addCustomEntriesToTable(UIDefaults table)
Adds values specific to this theme to the defaults table.ColorUIResource
getAcceleratorForeground()
Returns the accelerator foreground color.ColorUIResource
getAcceleratorSelectedForeground()
Returns the accelerator selected foreground color.protected ColorUIResource
getBlack()
Returns the black color.ColorUIResource
getControl()
Returns the control color.ColorUIResource
getControlDarkShadow()
Returns the control dark shadow color.ColorUIResource
getControlDisabled()
Returns the control disabled color.ColorUIResource
getControlHighlight()
Returns the control highlight color.ColorUIResource
getControlInfo()
Returns the control info color.ColorUIResource
getControlShadow()
Returns the control shadow color.ColorUIResource
getControlTextColor()
Returns the control text color.abstract FontUIResource
getControlTextFont()
Returns the control text font.ColorUIResource
getDesktopColor()
Returns the desktop color.ColorUIResource
getFocusColor()
Returns the focus color.ColorUIResource
getHighlightedTextColor()
Returns the highlighted text color.ColorUIResource
getInactiveControlTextColor()
Returns the inactive control text color.ColorUIResource
getInactiveSystemTextColor()
Returns the inactive system text color.ColorUIResource
getMenuBackground()
Returns the menu background color.ColorUIResource
getMenuDisabledForeground()
Returns the menu disabled foreground color.ColorUIResource
getMenuForeground()
Returns the menu foreground color.ColorUIResource
getMenuSelectedBackground()
Returns the menu selected background color.ColorUIResource
getMenuSelectedForeground()
Returns the menu selected foreground color.abstract FontUIResource
getMenuTextFont()
Returns the menu text font.abstract String
getName()
Returns the name of this theme.protected abstract ColorUIResource
getPrimary1()
Returns the primary 1 color.protected abstract ColorUIResource
getPrimary2()
Returns the primary 2 color.protected abstract ColorUIResource
getPrimary3()
Returns the primary 3 color.ColorUIResource
getPrimaryControl()
Returns the primary control color.ColorUIResource
getPrimaryControlDarkShadow()
Returns the primary control dark shadow color.ColorUIResource
getPrimaryControlHighlight()
Returns the primary control highlight color.ColorUIResource
getPrimaryControlInfo()
Returns the primary control info color.ColorUIResource
getPrimaryControlShadow()
Returns the primary control shadow color.protected abstract ColorUIResource
getSecondary1()
Returns the secondary 1 color.protected abstract ColorUIResource
getSecondary2()
Returns the secondary 2 color.protected abstract ColorUIResource
getSecondary3()
Returns the secondary 3 color.ColorUIResource
getSeparatorBackground()
Returns the separator background color.ColorUIResource
getSeparatorForeground()
Returns the separator foreground color.abstract FontUIResource
getSubTextFont()
Returns the sub-text font.ColorUIResource
getSystemTextColor()
Returns the system text color.abstract FontUIResource
getSystemTextFont()
Returns the system text font.ColorUIResource
getTextHighlightColor()
Returns the text highlight color.ColorUIResource
getUserTextColor()
Returns the user text color.abstract FontUIResource
getUserTextFont()
Returns the user text font.protected ColorUIResource
getWhite()
Returns the white color.ColorUIResource
getWindowBackground()
Returns the window background color.ColorUIResource
getWindowTitleBackground()
Returns the window title background color.abstract FontUIResource
getWindowTitleFont()
Returns the window title font.ColorUIResource
getWindowTitleForeground()
Returns the window title foreground color.ColorUIResource
getWindowTitleInactiveBackground()
Returns the window title inactive background color.ColorUIResource
getWindowTitleInactiveForeground()
Returns the window title inactive foreground color.
-
-
-
Method Detail
-
getName
public abstract String getName()
Returns the name of this theme.- Returns:
- the name of this theme
-
getPrimary1
protected abstract ColorUIResource getPrimary1()
Returns the primary 1 color.- Returns:
- the primary 1 color
-
getPrimary2
protected abstract ColorUIResource getPrimary2()
Returns the primary 2 color.- Returns:
- the primary 2 color
-
getPrimary3
protected abstract ColorUIResource getPrimary3()
Returns the primary 3 color.- Returns:
- the primary 3 color
-
getSecondary1
protected abstract ColorUIResource getSecondary1()
Returns the secondary 1 color.- Returns:
- the secondary 1 color
-
getSecondary2
protected abstract ColorUIResource getSecondary2()
Returns the secondary 2 color.- Returns:
- the secondary 2 color
-
getSecondary3
protected abstract ColorUIResource getSecondary3()
Returns the secondary 3 color.- Returns:
- the secondary 3 color
-
getControlTextFont
public abstract FontUIResource getControlTextFont()
Returns the control text font.- Returns:
- the control text font
-
getSystemTextFont
public abstract FontUIResource getSystemTextFont()
Returns the system text font.- Returns:
- the system text font
-
getUserTextFont
public abstract FontUIResource getUserTextFont()
Returns the user text font.- Returns:
- the user text font
-
getMenuTextFont
public abstract FontUIResource getMenuTextFont()
Returns the menu text font.- Returns:
- the menu text font
-
getWindowTitleFont
public abstract FontUIResource getWindowTitleFont()
Returns the window title font.- Returns:
- the window title font
-
getSubTextFont
public abstract FontUIResource getSubTextFont()
Returns the sub-text font.- Returns:
- the sub-text font
-
getWhite
protected ColorUIResource getWhite()
Returns the white color. This returns opaque white (0xFFFFFFFF
).- Returns:
- the white color
-
getBlack
protected ColorUIResource getBlack()
Returns the black color. This returns opaque black (0xFF000000
).- Returns:
- the black color
-
getFocusColor
public ColorUIResource getFocusColor()
Returns the focus color. This returns the value ofgetPrimary2()
.- Returns:
- the focus color
-
getDesktopColor
public ColorUIResource getDesktopColor()
Returns the desktop color. This returns the value ofgetPrimary2()
.- Returns:
- the desktop color
-
getControl
public ColorUIResource getControl()
Returns the control color. This returns the value ofgetSecondary3()
.- Returns:
- the control color
-
getControlShadow
public ColorUIResource getControlShadow()
Returns the control shadow color. This returns the value ofgetSecondary2()
.- Returns:
- the control shadow color
-
getControlDarkShadow
public ColorUIResource getControlDarkShadow()
Returns the control dark shadow color. This returns the value ofgetSecondary1()
.- Returns:
- the control dark shadow color
-
getControlInfo
public ColorUIResource getControlInfo()
Returns the control info color. This returns the value ofgetBlack()
.- Returns:
- the control info color
-
getControlHighlight
public ColorUIResource getControlHighlight()
Returns the control highlight color. This returns the value ofgetWhite()
.- Returns:
- the control highlight color
-
getControlDisabled
public ColorUIResource getControlDisabled()
Returns the control disabled color. This returns the value ofgetSecondary2()
.- Returns:
- the control disabled color
-
getPrimaryControl
public ColorUIResource getPrimaryControl()
Returns the primary control color. This returns the value ofgetPrimary3()
.- Returns:
- the primary control color
-
getPrimaryControlShadow
public ColorUIResource getPrimaryControlShadow()
Returns the primary control shadow color. This returns the value ofgetPrimary2()
.- Returns:
- the primary control shadow color
-
getPrimaryControlDarkShadow
public ColorUIResource getPrimaryControlDarkShadow()
Returns the primary control dark shadow color. This returns the value ofgetPrimary1()
.- Returns:
- the primary control dark shadow color
-
getPrimaryControlInfo
public ColorUIResource getPrimaryControlInfo()
Returns the primary control info color. This returns the value ofgetBlack()
.- Returns:
- the primary control info color
-
getPrimaryControlHighlight
public ColorUIResource getPrimaryControlHighlight()
Returns the primary control highlight color. This returns the value ofgetWhite()
.- Returns:
- the primary control highlight color
-
getSystemTextColor
public ColorUIResource getSystemTextColor()
Returns the system text color. This returns the value ofgetBlack()
.- Returns:
- the system text color
-
getControlTextColor
public ColorUIResource getControlTextColor()
Returns the control text color. This returns the value ofgetControlInfo()
.- Returns:
- the control text color
-
getInactiveControlTextColor
public ColorUIResource getInactiveControlTextColor()
Returns the inactive control text color. This returns the value ofgetControlDisabled()
.- Returns:
- the inactive control text color
-
getInactiveSystemTextColor
public ColorUIResource getInactiveSystemTextColor()
Returns the inactive system text color. This returns the value ofgetSecondary2()
.- Returns:
- the inactive system text color
-
getUserTextColor
public ColorUIResource getUserTextColor()
Returns the user text color. This returns the value ofgetBlack()
.- Returns:
- the user text color
-
getTextHighlightColor
public ColorUIResource getTextHighlightColor()
Returns the text highlight color. This returns the value ofgetPrimary3()
.- Returns:
- the text highlight color
-
getHighlightedTextColor
public ColorUIResource getHighlightedTextColor()
Returns the highlighted text color. This returns the value ofgetControlTextColor()
.- Returns:
- the highlighted text color
-
getWindowBackground
public ColorUIResource getWindowBackground()
Returns the window background color. This returns the value ofgetWhite()
.- Returns:
- the window background color
-
getWindowTitleBackground
public ColorUIResource getWindowTitleBackground()
Returns the window title background color. This returns the value ofgetPrimary3()
.- Returns:
- the window title background color
-
getWindowTitleForeground
public ColorUIResource getWindowTitleForeground()
Returns the window title foreground color. This returns the value ofgetBlack()
.- Returns:
- the window title foreground color
-
getWindowTitleInactiveBackground
public ColorUIResource getWindowTitleInactiveBackground()
Returns the window title inactive background color. This returns the value ofgetSecondary3()
.- Returns:
- the window title inactive background color
-
getWindowTitleInactiveForeground
public ColorUIResource getWindowTitleInactiveForeground()
Returns the window title inactive foreground color. This returns the value ofgetBlack()
.- Returns:
- the window title inactive foreground color
-
getMenuBackground
public ColorUIResource getMenuBackground()
Returns the menu background color. This returns the value ofgetSecondary3()
.- Returns:
- the menu background color
-
getMenuForeground
public ColorUIResource getMenuForeground()
Returns the menu foreground color. This returns the value ofgetBlack()
.- Returns:
- the menu foreground color
-
getMenuSelectedBackground
public ColorUIResource getMenuSelectedBackground()
Returns the menu selected background color. This returns the value ofgetPrimary2()
.- Returns:
- the menu selected background color
-
getMenuSelectedForeground
public ColorUIResource getMenuSelectedForeground()
Returns the menu selected foreground color. This returns the value ofgetBlack()
.- Returns:
- the menu selected foreground color
-
getMenuDisabledForeground
public ColorUIResource getMenuDisabledForeground()
Returns the menu disabled foreground color. This returns the value ofgetSecondary2()
.- Returns:
- the menu disabled foreground color
-
getSeparatorBackground
public ColorUIResource getSeparatorBackground()
Returns the separator background color. This returns the value ofgetWhite()
.- Returns:
- the separator background color
-
getSeparatorForeground
public ColorUIResource getSeparatorForeground()
Returns the separator foreground color. This returns the value ofgetPrimary1()
.- Returns:
- the separator foreground color
-
getAcceleratorForeground
public ColorUIResource getAcceleratorForeground()
Returns the accelerator foreground color. This returns the value ofgetPrimary1()
.- Returns:
- the accelerator foreground color
-
getAcceleratorSelectedForeground
public ColorUIResource getAcceleratorSelectedForeground()
Returns the accelerator selected foreground color. This returns the value ofgetBlack()
.- Returns:
- the accelerator selected foreground color
-
addCustomEntriesToTable
public void addCustomEntriesToTable(UIDefaults table)
Adds values specific to this theme to the defaults table. This method is invoked when the look and feel defaults are obtained fromMetalLookAndFeel
.This implementation does nothing; it is provided for subclasses that wish to customize the defaults table.
- Parameters:
table
- theUIDefaults
to add the values to- See Also:
MetalLookAndFeel.getDefaults()
-
-
Traduction non disponible
Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Version en cache
28/12/2024 21:57:08 Cette version de la page est en cache (à la date du 28/12/2024 21:57:08) afin d'accélérer le traitement. Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la dernère version de la page.Document créé le 31/08/2006, dernière modification le 04/03/2020
Source du document imprimé : https://www.gaudry.be/java-api-rf-javax/swing/plaf/metal/MetalTheme.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.