55 * very quickly.</p> 56 * 57 * <p>For example, the following might be an implementation of a custom 58 * "Indeterminate" state for JProgressBars:</p> 59 * 60 * <pre><code> 61 * public final class IndeterminateState extends State<JProgressBar> { 62 * public IndeterminateState() { 63 * super("Indeterminate"); 64 * } 65 * 66 * @Override 67 * protected boolean isInState(JProgressBar c) { 68 * return c.isIndeterminate(); 69 * } 70 * } 71 * </code></pre> 72 */ 73 public abstract class State<T extends JComponent>{ 74 static final Map<String, StandardState> standardStates = new HashMap<String, StandardState>(7); 75 static final State Enabled = new StandardState(SynthConstants.ENABLED); 76 static final State MouseOver = new StandardState(SynthConstants.MOUSE_OVER); 77 static final State Pressed = new StandardState(SynthConstants.PRESSED); 78 static final State Disabled = new StandardState(SynthConstants.DISABLED); 79 static final State Focused = new StandardState(SynthConstants.FOCUSED); 80 static final State Selected = new StandardState(SynthConstants.SELECTED); 81 static final State Default = new StandardState(SynthConstants.DEFAULT); 82 83 private String name; 84 85 /** 86 * <p>Create a new custom State. Specify the name for the state. The name should 87 * be unique within the states set for any one particular component. 88 * The name of the state should coincide with the name used in UIDefaults.</p> 89 * 90 * <p>For example, the following would be correct:</p> 91 * <pre><code> 92 * defaults.put("Button.States", "Enabled, Foo, Disabled"); 93 * defaults.put("Button.Foo", new FooState("Foo")); 94 * </code></pre> 95 * 96 * @param name a simple user friendly name for the state, such as "Indeterminate" 97 * or "EmbeddedPanel" or "Blurred". It is customary to use camel case, 98 * with the first letter capitalized. 99 */ 100 protected State(String name) { 101 this.name = name; | 55 * very quickly.</p> 56 * 57 * <p>For example, the following might be an implementation of a custom 58 * "Indeterminate" state for JProgressBars:</p> 59 * 60 * <pre><code> 61 * public final class IndeterminateState extends State<JProgressBar> { 62 * public IndeterminateState() { 63 * super("Indeterminate"); 64 * } 65 * 66 * @Override 67 * protected boolean isInState(JProgressBar c) { 68 * return c.isIndeterminate(); 69 * } 70 * } 71 * </code></pre> 72 */ 73 public abstract class State<T extends JComponent>{ 74 static final Map<String, StandardState> standardStates = new HashMap<String, StandardState>(7); 75 static final State<JComponent> Enabled = new StandardState(SynthConstants.ENABLED); 76 static final State<JComponent> MouseOver = new StandardState(SynthConstants.MOUSE_OVER); 77 static final State<JComponent> Pressed = new StandardState(SynthConstants.PRESSED); 78 static final State<JComponent> Disabled = new StandardState(SynthConstants.DISABLED); 79 static final State<JComponent> Focused = new StandardState(SynthConstants.FOCUSED); 80 static final State<JComponent> Selected = new StandardState(SynthConstants.SELECTED); 81 static final State<JComponent> Default = new StandardState(SynthConstants.DEFAULT); 82 83 private String name; 84 85 /** 86 * <p>Create a new custom State. Specify the name for the state. The name should 87 * be unique within the states set for any one particular component. 88 * The name of the state should coincide with the name used in UIDefaults.</p> 89 * 90 * <p>For example, the following would be correct:</p> 91 * <pre><code> 92 * defaults.put("Button.States", "Enabled, Foo, Disabled"); 93 * defaults.put("Button.Foo", new FooState("Foo")); 94 * </code></pre> 95 * 96 * @param name a simple user friendly name for the state, such as "Indeterminate" 97 * or "EmbeddedPanel" or "Blurred". It is customary to use camel case, 98 * with the first letter capitalized. 99 */ 100 protected State(String name) { 101 this.name = name; |