< prev index next >
src/java.desktop/share/classes/javax/swing/plaf/synth/ColorType.java
Print this page
*** 25,51 ****
package javax.swing.plaf.synth;
/**
* A typesafe enumeration of colors that can be fetched from a style.
* <p>
! * Each <code>SynthStyle</code> has a set of <code>ColorType</code>s that
* are accessed by way of the
* {@link SynthStyle#getColor(SynthContext, ColorType)} method.
! * <code>SynthStyle</code>'s <code>installDefaults</code> will install
! * the <code>FOREGROUND</code> color
* as the foreground of
! * the Component, and the <code>BACKGROUND</code> color to the background of
* the component (assuming that you have not explicitly specified a
* foreground and background color). Some components
* support more color based properties, for
! * example <code>JList</code> has the property
! * <code>selectionForeground</code> which will be mapped to
! * <code>FOREGROUND</code> with a component state of
! * <code>SynthConstants.SELECTED</code>.
* <p>
! * The following example shows a custom <code>SynthStyle</code> that returns
! * a red Color for the <code>DISABLED</code> state, otherwise a black color.
* <pre>
* class MyStyle extends SynthStyle {
* private Color disabledColor = new ColorUIResource(Color.RED);
* private Color color = new ColorUIResource(Color.BLACK);
* protected Color getColorForState(SynthContext context, ColorType type){
--- 25,51 ----
package javax.swing.plaf.synth;
/**
* A typesafe enumeration of colors that can be fetched from a style.
* <p>
! * Each {@code SynthStyle} has a set of {@code ColorType}s that
* are accessed by way of the
* {@link SynthStyle#getColor(SynthContext, ColorType)} method.
! * {@code SynthStyle}'s {@code installDefaults} will install
! * the {@code FOREGROUND} color
* as the foreground of
! * the Component, and the {@code BACKGROUND} color to the background of
* the component (assuming that you have not explicitly specified a
* foreground and background color). Some components
* support more color based properties, for
! * example {@code JList} has the property
! * {@code selectionForeground} which will be mapped to
! * {@code FOREGROUND} with a component state of
! * {@code SynthConstants.SELECTED}.
* <p>
! * The following example shows a custom {@code SynthStyle} that returns
! * a red Color for the {@code DISABLED} state, otherwise a black color.
* <pre>
* class MyStyle extends SynthStyle {
* private Color disabledColor = new ColorUIResource(Color.RED);
* private Color color = new ColorUIResource(Color.BLACK);
* protected Color getColorForState(SynthContext context, ColorType type){
*** 87,97 ****
* ColorType for the focus.
*/
public static final ColorType FOCUS = new ColorType("Focus");
/**
! * Maximum number of <code>ColorType</code>s.
*/
public static final int MAX_COUNT;
private static int nextID;
--- 87,97 ----
* ColorType for the focus.
*/
public static final ColorType FOCUS = new ColorType("Focus");
/**
! * Maximum number of {@code ColorType}s.
*/
public static final int MAX_COUNT;
private static int nextID;
*** 127,138 ****
public final int getID() {
return index;
}
/**
! * Returns the textual description of this <code>ColorType</code>.
! * This is the same value that the <code>ColorType</code> was created
* with.
*
* @return the description of the string
*/
public String toString() {
--- 127,138 ----
public final int getID() {
return index;
}
/**
! * Returns the textual description of this {@code ColorType}.
! * This is the same value that the {@code ColorType} was created
* with.
*
* @return the description of the string
*/
public String toString() {
< prev index next >