01: /*
02: * @(#)BackgroundSupport.java 1/15/2007
03: *
04: * Copyright 2002 - 2007 JIDE Software Inc. All rights reserved.
05: */
06:
07: package com.jidesoft.swing;
08:
09: import java.awt.*;
10:
11: /**
12: * A component should implement this interface if it supports various background and foreground
13: * for different states. Those states are defined in {@link com.jidesoft.plaf.basic.ThemePainter}.
14: * <p/>
15: * For components that implements this interface, you can use the methods to change its background
16: * or foregound for different states such as rollover state, selected state or pressed state. JideButton
17: * and JideSplitButton are two classes that support this.
18: * <p/>
19: * Please note, not all L&Fs support this. Vsnet and Office 2003 style support it but Xerto and Eclipse style don't.
20: */
21: public interface ComponentStateSupport {
22: /**
23: * Gets the background for different states. The states are defined in ThemePainter as constants.
24: * Not all states are supported by all components. If the state is not supported or background is never set,
25: * it will return null.
26: * <p/>
27: * Please note, each L&F will have its own way to paint the different backgrounds. This method allows you to customize it
28: * for each component to use a different background. So if you want the background to be used, don't use a ColorUIResource because
29: * UIResource is considered as a setting set by the L&F and any L&F can choose to ignore it.
30: *
31: * @param state
32: * @return the background for different states.
33: */
34: Color getBackgroundOfState(int state);
35:
36: /**
37: * Sets the background for different states.
38: *
39: * @param state
40: * @param color
41: */
42: void setBackgroundOfState(int state, Color color);
43:
44: /**
45: * Gets the foreground for different states. The states are defined in ThemePainter as constants.
46: * Not all states are supported by all components. If the state is not supported or foreground is never set,
47: * it will return null.
48: * <p/>
49: * Please note, each L&F will have its own way to paint the different foregrounds. This method allows you to customize it
50: * for each component to use a different foreground. So if you want the foreground to be used, don't use a ColorUIResource because
51: * UIResource is considered as a setting set by the L&F and any L&F can choose to ignore it.
52: *
53: * @param state
54: * @return the foreground for different states.
55: */
56: Color getForegroundOfState(int state);
57:
58: /**
59: * Sets the foreground for different states.
60: *
61: * @param state
62: * @param color
63: */
64: void setForegroundOfState(int state, Color color);
65: }
|