Source for javax.swing.plaf.metal.OceanTheme

   1: /* DefaultMetalTheme.java -- A modern theme for the Metal L&F
   2:    Copyright (C) 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: package javax.swing.plaf.metal;
  39: 
  40: import javax.swing.UIDefaults;
  41: import javax.swing.plaf.ColorUIResource;
  42: 
  43: /**
  44:  * A modern theme for the Metal Look & Feel.
  45:  * @since 1.5
  46:  *
  47:  * @author Roman Kennke (roman@kennke.org)
  48:  */
  49: public class OceanTheme extends DefaultMetalTheme
  50: {
  51:   /**
  52:    * The OceanTheme value for black.
  53:    */
  54:   static final ColorUIResource BLACK = new ColorUIResource(51, 51, 51);
  55: 
  56:   /**
  57:    * The OceanTheme value for primary1.
  58:    */
  59:   static final ColorUIResource PRIMARY1 = new ColorUIResource(99, 130, 191);
  60: 
  61:   /**
  62:    * The OceanTheme value for primary1.
  63:    */
  64:   static final ColorUIResource PRIMARY2 = new ColorUIResource(163, 184, 204);
  65: 
  66:   /**
  67:    * The OceanTheme value for primary1.
  68:    */
  69:   static final ColorUIResource PRIMARY3 = new ColorUIResource(184, 207, 229);
  70: 
  71:   /**
  72:    * The OceanTheme value for secondary1.
  73:    */
  74:   static final ColorUIResource SECONDARY1 = new ColorUIResource(122, 138, 153);
  75: 
  76:   /**
  77:    * The OceanTheme value for secondary2.
  78:    */
  79:   static final ColorUIResource SECONDARY2 = new ColorUIResource(184, 207, 229);
  80: 
  81:   /**
  82:    * The OceanTheme value for secondary3.
  83:    */
  84:   static final ColorUIResource SECONDARY3 = new ColorUIResource(238, 238, 238);
  85: 
  86:   /**
  87:    * The OceanTheme value for inactive control text.
  88:    */
  89:   static final ColorUIResource INACTIVE_CONTROL_TEXT =
  90:     new ColorUIResource(153, 153, 153);
  91: 
  92:   /**
  93:    * Returns the name of this theme, "Ocean"
  94:    */
  95:   public String getName()
  96:   {
  97:     return "Ocean";
  98:   }
  99: 
 100:   /**
 101:    * Returns the color for control text, which is the
 102:    * value of the theme's black value.
 103:    */
 104:   public ColorUIResource getControlTextColor()
 105:   {
 106:     return getBlack();
 107:   }
 108: 
 109:   /**
 110:    * Returns the desktop color, which is the theme's white color.
 111:    */
 112:   public ColorUIResource getDesktopColor()
 113:   {
 114:     return getWhite();
 115:   }
 116: 
 117:   /**
 118:    * Returns the color for inactive control text, which is the
 119:    * RGB value (153, 153, 153).
 120:    */
 121:   public ColorUIResource getInactiveControlTextColor()
 122:   {
 123:     return INACTIVE_CONTROL_TEXT;
 124:   }
 125: 
 126:   /**
 127:    * Returns the OceanTheme's color for disabled menu foreground,
 128:    * 
 129:    */
 130:   public ColorUIResource getMenuDisabledForeground()
 131:   {
 132:     return INACTIVE_CONTROL_TEXT;
 133:   }
 134: 
 135:   
 136:   /**
 137:    * Returns the OceanTheme's color for black, the RGB value
 138:    * (51, 51, 51).
 139:    *
 140:    * @return Returns the OceanTheme's value for black 
 141:    */
 142:   protected ColorUIResource getBlack()
 143:   {
 144:     return BLACK;
 145:   }
 146: 
 147:   /**
 148:    * Return the OceanTheme's value for primary 1, the RGB value
 149:    * (99, 130, 191).
 150:    */
 151:   protected ColorUIResource getPrimary1()
 152:   {
 153:     return PRIMARY1;
 154:   }
 155:   
 156:   /**
 157:    * Return the OceanTheme's value for primary 2, the RGB value
 158:    * (163, 184, 204).
 159:    */
 160:   protected ColorUIResource getPrimary2()
 161:   {
 162:     return PRIMARY2;
 163:   }
 164:   
 165:   /**
 166:    * Return the OceanTheme's value for primary 1, the RGB value
 167:    * (184, 207, 229).
 168:    */
 169:   protected ColorUIResource getPrimary3()
 170:   {
 171:     return PRIMARY3;
 172:   }
 173: 
 174:   /**
 175:    * Return the OceanTheme's value for secondary 1, the RGB value
 176:    * (122, 138, 153).
 177:    */
 178:   protected ColorUIResource getSecondary1()
 179:   {
 180:     return SECONDARY1;
 181:   }
 182: 
 183:   /**
 184:    * Return the OceanTheme's value for secondary 2, the RGB value
 185:    * (184, 207, 229).
 186:    */
 187:   protected ColorUIResource getSecondary2()
 188:   {
 189:     return SECONDARY2;
 190:   }
 191:   /**
 192:    * Return the OceanTheme's value for secondary 3, the RGB value
 193:    * (238, 238, 238).
 194:    */
 195:   protected ColorUIResource getSecondary3()
 196:   {
 197:     return SECONDARY3;
 198:   }
 199: 
 200:   /**
 201:    * Adds customized entries to the UIDefaults table.
 202:    *
 203:    * @param defaults the UI defaults table
 204:    */
 205:   public void addCustomEntriesToTable(UIDefaults defaults)
 206:   {
 207:     defaults.put("Button.rollover", Boolean.TRUE);
 208:   }
 209: }