A concrete implementation of {@code MetalTheme} providing
the original look of the Java Look and Feel, code-named "Steel". Refer
to
for details on changing
the default theme.
{@code DefaultMetalTheme} uses bold fonts for many controls. To make all
controls (with the exception of the internal frame title bars and
client decorated frame title bars) use plain fonts you can do either of
the following:
, if set,
takes precendence over the system property of the same name. After
setting this defaults property you need to re-install
, as well as update the UI
of any previously created widgets. Otherwise the results are undefined.
The following illustrates how to do this:
| Method from javax.swing.plaf.metal.DefaultMetalTheme Detail: |
public FontUIResource getControlTextFont() {
return getFont(CONTROL_TEXT_FONT);
}
Returns the control text font. This returns Dialog, 12pt. If
plain fonts have been enabled as described in
font style, the font style is plain. Otherwise the font style is
bold. |
static String getDefaultFontName(int key) {
return fontNames[key];
}
Returns the ideal font name for the font identified by key. |
static int getDefaultFontSize(int key) {
return fontSizes[key];
}
Returns the ideal font size for the font identified by key. |
static int getDefaultFontStyle(int key) {
if (key != WINDOW_TITLE_FONT) {
Object boldMetal = null;
if (AppContext.getAppContext().get(
SwingUtilities2.LAF_STATE_KEY) != null) {
// Only access the boldMetal key if a look and feel has
// been loaded, otherwise we'll trigger loading the look
// and feel.
boldMetal = UIManager.get("swing.boldMetal");
}
if (boldMetal != null) {
if (Boolean.FALSE.equals(boldMetal)) {
return Font.PLAIN;
}
}
else if (PLAIN_FONTS) {
return Font.PLAIN;
}
}
return fontStyles[key];
}
Returns the ideal font style for the font identified by key. |
static String getDefaultPropertyName(int key) {
return defaultNames[key];
}
Returns the default used to look up the specified font. |
public FontUIResource getMenuTextFont() {
return getFont(MENU_TEXT_FONT);
}
Returns the menu text font. This returns Dialog, 12pt. If
plain fonts have been enabled as described in
font style, the font style is plain. Otherwise the font style is
bold. |
public String getName() {
return "Steel";
}
Returns the name of this theme. This returns {@code "Steel"}. |
protected ColorUIResource getPrimary1() {
return primary1;
}
Returns the primary 1 color. This returns a color with rgb values
of 102, 102, and 153, respectively. |
protected ColorUIResource getPrimary2() {
return primary2;
}
Returns the primary 2 color. This returns a color with rgb values
of 153, 153, 204, respectively. |
protected ColorUIResource getPrimary3() {
return primary3;
}
Returns the primary 3 color. This returns a color with rgb values
204, 204, 255, respectively. |
protected ColorUIResource getSecondary1() {
return secondary1;
}
Returns the secondary 1 color. This returns a color with rgb values
102, 102, and 102, respectively. |
protected ColorUIResource getSecondary2() {
return secondary2;
}
Returns the secondary 2 color. This returns a color with rgb values
153, 153, and 153, respectively. |
protected ColorUIResource getSecondary3() {
return secondary3;
}
Returns the secondary 3 color. This returns a color with rgb values
204, 204, and 204, respectively. |
public FontUIResource getSubTextFont() {
return getFont(SUB_TEXT_FONT);
}
Returns the sub-text font. This returns Dialog, 10pt, plain. |
public FontUIResource getSystemTextFont() {
return getFont(SYSTEM_TEXT_FONT);
}
Returns the system text font. This returns Dialog, 12pt, plain. |
public FontUIResource getUserTextFont() {
return getFont(USER_TEXT_FONT);
}
Returns the user text font. This returns Dialog, 12pt, plain. |
public FontUIResource getWindowTitleFont() {
return getFont(WINDOW_TITLE_FONT);
}
Returns the window title font. This returns Dialog, 12pt, bold. |
void install() {
if (MetalLookAndFeel.isWindows() &&
MetalLookAndFeel.useSystemFonts()) {
fontDelegate = new WindowsFontDelegate();
}
else {
fontDelegate = new FontDelegate();
}
}
|
boolean isSystemTheme() {
return (getClass() == DefaultMetalTheme.class);
}
Returns true if this is a theme provided by the core platform. |