GNU Classpath (0.20) | |
Frames | No Frames |
1: /* DefaultMetalTheme.java -- 2: Copyright (C) 2004, 2005 Free Software Foundation, Inc. 3: 4: This file is part of GNU Classpath. 5: 6: GNU Classpath is free software; you can redistribute it and/or modify 7: it under the terms of the GNU General Public License as published by 8: the Free Software Foundation; either version 2, or (at your option) 9: any later version. 10: 11: GNU Classpath is distributed in the hope that it will be useful, but 12: WITHOUT ANY WARRANTY; without even the implied warranty of 13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14: General Public License for more details. 15: 16: You should have received a copy of the GNU General Public License 17: along with GNU Classpath; see the file COPYING. If not, write to the 18: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 19: 02110-1301 USA. 20: 21: Linking this library statically or dynamically with other modules is 22: making a combined work based on this library. Thus, the terms and 23: conditions of the GNU General Public License cover the whole 24: combination. 25: 26: As a special exception, the copyright holders of this library give you 27: permission to link this library with independent modules to produce an 28: executable, regardless of the license terms of these independent 29: modules, and to copy and distribute the resulting executable under 30: terms of your choice, provided that you also meet, for each linked 31: independent module, the terms and conditions of the license of that 32: module. An independent module is a module which is not derived from 33: or based on this library. If you modify this library, you may extend 34: this exception to your version of the library, but you are not 35: obligated to do so. If you do not wish to do so, delete this 36: exception statement from your version. */ 37: 38: 39: package javax.swing.plaf.metal; 40: 41: import java.awt.Font; 42: 43: import javax.swing.plaf.ColorUIResource; 44: import javax.swing.plaf.FontUIResource; 45: 46: /** 47: * The default theme for the {@link MetalLookAndFeel}. 48: * 49: * @see MetalLookAndFeel#setCurrentTheme(MetalTheme) 50: */ 51: public class DefaultMetalTheme extends MetalTheme 52: { 53: private static final ColorUIResource PRIMARY1 = 54: new ColorUIResource(102, 102, 153); 55: private static final ColorUIResource PRIMARY2 = 56: new ColorUIResource(153, 153, 204); 57: private static final ColorUIResource PRIMARY3 = 58: new ColorUIResource(204, 204, 255); 59: private static final ColorUIResource SECONDARY1 = 60: new ColorUIResource(102, 102, 102); 61: private static final ColorUIResource SECONDARY2 = 62: new ColorUIResource(153, 153, 153); 63: private static final ColorUIResource SECONDARY3 = 64: new ColorUIResource(204, 204, 204); 65: 66: private static final FontUIResource CONTROL_TEXT_FONT = 67: new FontUIResource("Dialog", Font.BOLD, 12); 68: private static final FontUIResource MENU_TEXT_FONT = 69: new FontUIResource("Dialog", Font.BOLD, 12); 70: private static final FontUIResource SUB_TEXT_FONT = 71: new FontUIResource("Dialog", Font.PLAIN, 10); 72: private static final FontUIResource SYSTEM_TEXT_FONT = 73: new FontUIResource("Dialog", Font.PLAIN, 12); 74: private static final FontUIResource USER_TEXT_FONT = 75: new FontUIResource("Dialog", Font.PLAIN, 12); 76: private static final FontUIResource WINDOW_TITLE_FONT = 77: new FontUIResource("Dialog", Font.BOLD, 12); 78: 79: /** 80: * Creates a new instance of this theme. 81: */ 82: public DefaultMetalTheme() 83: { 84: // Do nothing here. 85: } 86: 87: /** 88: * Returns the name of the theme. 89: * 90: * @return <code>"Steel"</code>. 91: */ 92: public String getName() 93: { 94: return "Steel"; 95: } 96: 97: /** 98: * Returns the first primary color for this theme. 99: * 100: * @return The first primary color. 101: */ 102: protected ColorUIResource getPrimary1() 103: { 104: return PRIMARY1; 105: } 106: 107: /** 108: * Returns the second primary color for this theme. 109: * 110: * @return The second primary color. 111: */ 112: protected ColorUIResource getPrimary2() 113: { 114: return PRIMARY2; 115: } 116: 117: /** 118: * Returns the third primary color for this theme. 119: * 120: * @return The third primary color. 121: */ 122: protected ColorUIResource getPrimary3() 123: { 124: return PRIMARY3; 125: } 126: 127: /** 128: * Returns the first secondary color for this theme. 129: * 130: * @return The first secondary color. 131: */ 132: protected ColorUIResource getSecondary1() 133: { 134: return SECONDARY1; 135: } 136: 137: /** 138: * Returns the second secondary color for this theme. 139: * 140: * @return The second secondary color. 141: */ 142: protected ColorUIResource getSecondary2() 143: { 144: return SECONDARY2; 145: } 146: 147: /** 148: * Returns the third secondary color for this theme. 149: * 150: * @return The third secondary color. 151: */ 152: protected ColorUIResource getSecondary3() 153: { 154: return SECONDARY3; 155: } 156: 157: /** 158: * Returns the font used for text on controls. In this case, the font is 159: * <code>FontUIResource("Dialog", Font.BOLD, 12)</code>. 160: * 161: * @return The font. 162: */ 163: public FontUIResource getControlTextFont() 164: { 165: return CONTROL_TEXT_FONT; 166: } 167: /** 168: * Returns the font used for text in menus. In this case, the font is 169: * <code>FontUIResource("Dialog", Font.BOLD, 12)</code>. 170: * 171: * @return The font used for text in menus. 172: */ 173: public FontUIResource getMenuTextFont() 174: { 175: return MENU_TEXT_FONT; 176: } 177: 178: /** 179: * Returns the font used for sub text. In this case, the font is 180: * <code>FontUIResource("Dialog", Font.PLAIN, 10)</code>. 181: * 182: * @return The font used for sub text. 183: */ 184: public FontUIResource getSubTextFont() 185: { 186: return SUB_TEXT_FONT; 187: } 188: 189: /** 190: * Returns the font used for system text. In this case, the font is 191: * <code>FontUIResource("Dialog", Font.PLAIN, 12)</code>. 192: * 193: * @return The font used for system text. 194: */ 195: public FontUIResource getSystemTextFont() 196: { 197: return SYSTEM_TEXT_FONT; 198: } 199: 200: /** 201: * Returns the font used for user text. In this case, the font is 202: * <code>FontUIResource("Dialog", Font.PLAIN, 12)</code>. 203: * 204: * @return The font used for user text. 205: */ 206: public FontUIResource getUserTextFont() 207: { 208: return USER_TEXT_FONT; 209: } 210: 211: /** 212: * Returns the font used for window titles. In this case, the font is 213: * <code>FontUIResource("Dialog", Font.BOLD, 12)</code>. 214: * 215: * @return The font used for window titles. 216: */ 217: public FontUIResource getWindowTitleFont() 218: { 219: return WINDOW_TITLE_FONT; 220: } 221: }
GNU Classpath (0.20) |