< prev index next >

src/java.desktop/share/classes/javax/swing/plaf/nimbus/NimbusStyle.java

Print this page

        

*** 99,118 **** * <p>Sometimes, however, you need to have a custom state. For example, you * want JButton to render differently if it's parent is a JToolbar. In Nimbus, * you specify these custom states by including a special key in UIDefaults. * The following UIDefaults entries define three states for this button:</p> * ! * <pre><code> * JButton.States = Enabled, Disabled, Toolbar * JButton[Enabled].backgroundPainter = somePainter * JButton[Disabled].background = BLUE * JButton[Toolbar].backgroundPainter = someOtherPaint ! * </code></pre> * ! * <p>As you can see, the <code>JButton.States</code> entry lists the states * that the JButton style will support. You then specify the settings for ! * each state. If you do not specify the <code>JButton.States</code> entry, * then the standard Synth states will be assumed. If you specify the entry * but the list of states is empty or null, then the standard synth states * will be assumed.</p> * * @author Richard Bair --- 99,118 ---- * <p>Sometimes, however, you need to have a custom state. For example, you * want JButton to render differently if it's parent is a JToolbar. In Nimbus, * you specify these custom states by including a special key in UIDefaults. * The following UIDefaults entries define three states for this button:</p> * ! * <pre>{@code * JButton.States = Enabled, Disabled, Toolbar * JButton[Enabled].backgroundPainter = somePainter * JButton[Disabled].background = BLUE * JButton[Toolbar].backgroundPainter = someOtherPaint ! * }</pre> * ! * <p>As you can see, the {@code JButton.States} entry lists the states * that the JButton style will support. You then specify the settings for ! * each state. If you do not specify the {@code JButton.States} entry, * then the standard Synth states will be assumed. If you specify the entry * but the list of states is empty or null, then the standard synth states * will be assumed.</p> * * @author Richard Bair
*** 145,155 **** * <p>The Color to return from getColorForState if it would otherwise have * returned null.</p> * * <p>Returning null from getColorForState is a very bad thing, as it causes * the AWT peer for the component to install a SystemColor, which is not a ! * UIResource. As a result, if <code>null</code> is returned from * getColorForState, then thereafter the color is not updated for other * states or on LAF changes or updates. This DEFAULT_COLOR is used to * ensure that a ColorUIResource is always returned from * getColorForState.</p> */ --- 145,155 ---- * <p>The Color to return from getColorForState if it would otherwise have * returned null.</p> * * <p>Returning null from getColorForState is a very bad thing, as it causes * the AWT peer for the component to install a SystemColor, which is not a ! * UIResource. As a result, if {@code null} is returned from * getColorForState, then thereafter the color is not updated for other * states or on LAF changes or updates. This DEFAULT_COLOR is used to * ensure that a ColorUIResource is always returned from * getColorForState.</p> */
*** 921,936 **** * Enabled * Enabled+Pressed * Disabled * </pre> * And you wanted to find the state that best represented ! * ENABLED+PRESSED+FOCUSED and <code>lastState</code> was null (or an * empty array, or an array with a single int with index == -1), then * Enabled+Pressed would be returned. If you then call this method again but * pass the index of Enabled+Pressed as the "lastState", then * Enabled would be returned. If you call this method a third time and pass ! * the index of Enabled in as the <code>lastState</code>, then null would be * returned.</p> * * <p>The actual code path for determining the proper state is the same as * in Synth.</p> * --- 921,936 ---- * Enabled * Enabled+Pressed * Disabled * </pre> * And you wanted to find the state that best represented ! * ENABLED+PRESSED+FOCUSED and {@code lastState} was null (or an * empty array, or an array with a single int with index == -1), then * Enabled+Pressed would be returned. If you then call this method again but * pass the index of Enabled+Pressed as the "lastState", then * Enabled would be returned. If you call this method a third time and pass ! * the index of Enabled in as the {@code lastState}, then null would be * returned.</p> * * <p>The actual code path for determining the proper state is the same as * in Synth.</p> *
*** 1024,1034 **** return null; } /** * Contains values such as the UIDefaults and painters associated with ! * a state. Whereas <code>State</code> represents a distinct state that a * component can be in (such as Enabled), this class represents the colors, * fonts, painters, etc associated with some state for this * style. */ private final class RuntimeState implements Cloneable { --- 1024,1034 ---- return null; } /** * Contains values such as the UIDefaults and painters associated with ! * a state. Whereas {@code State} represents a distinct state that a * component can be in (such as Enabled), this class represents the colors, * fonts, painters, etc associated with some state for this * style. */ private final class RuntimeState implements Cloneable {
< prev index next >