35 |
obligated to do so. If you do not wish to do so, delete this |
obligated to do so. If you do not wish to do so, delete this |
36 |
exception statement from your version. */ |
exception statement from your version. */ |
37 |
|
|
|
|
|
38 |
package javax.swing.colorchooser; |
package javax.swing.colorchooser; |
39 |
|
|
40 |
import java.awt.Color; |
import java.awt.Color; |
43 |
import javax.swing.JColorChooser; |
import javax.swing.JColorChooser; |
44 |
import javax.swing.JPanel; |
import javax.swing.JPanel; |
45 |
|
|
46 |
|
|
47 |
/** |
/** |
48 |
* AbstractColorChooserPanel |
* AbstractColorChooserPanel |
49 |
* @author Andrew Selkirk |
* |
50 |
* @version 1.0 |
* @author Andrew Selkirk |
51 |
|
* @version 1.0 |
52 |
*/ |
*/ |
53 |
public abstract class AbstractColorChooserPanel extends JPanel |
public abstract class AbstractColorChooserPanel extends JPanel |
54 |
{ |
{ |
55 |
|
/** DOCUMENT ME! */ |
56 |
private static final long serialVersionUID = -977469671210173863L; |
private static final long serialVersionUID = -977469671210173863L; |
57 |
|
|
58 |
/** |
/** The chooser associated with this panel. */ |
59 |
* chooser |
private JColorChooser chooser; |
60 |
*/ |
|
61 |
private JColorChooser chooser; |
/** |
62 |
|
* This is the constructor for the AbstractColorChooserPanel. |
63 |
/** |
*/ |
64 |
* Constructor AbstractColorChooserPanel |
public AbstractColorChooserPanel() |
65 |
*/ |
{ |
66 |
public AbstractColorChooserPanel() { |
} // AbstractColorChooserPanel() |
67 |
// TODO |
|
68 |
} // AbstractColorChooserPanel() |
/** |
69 |
|
* This method returns the name displayed in the tab for this chooser panel. |
70 |
/** |
* |
71 |
* getDisplayName |
* @return The name displayed in the JTabbedPane's tabs. |
72 |
* @returns String |
*/ |
73 |
*/ |
public abstract String getDisplayName(); |
74 |
public abstract String getDisplayName(); |
|
75 |
|
/** |
76 |
/** |
* This method updates the chooser panel when the JColorChooser's color has |
77 |
* updateChooser |
* changed. |
78 |
*/ |
*/ |
79 |
public abstract void updateChooser(); |
public abstract void updateChooser(); |
80 |
|
|
81 |
/** |
/** |
82 |
* buildChooser |
* This method constructs and does any initialization necessary for the |
83 |
*/ |
* chooser panel. |
84 |
protected abstract void buildChooser(); |
*/ |
85 |
|
protected abstract void buildChooser(); |
86 |
/** |
|
87 |
* getSmallDisplayIcon |
/** |
88 |
* @returns Icon |
* This method sets the small icon used in the JTabbedPane for this chooser |
89 |
*/ |
* panel. |
90 |
public abstract Icon getSmallDisplayIcon(); |
* |
91 |
|
* @return The small icon used in the JTabbedPane. |
92 |
/** |
*/ |
93 |
* getLargeDisplayIcon |
public abstract Icon getSmallDisplayIcon(); |
94 |
* @returns Icon |
|
95 |
*/ |
/** |
96 |
public abstract Icon getLargeDisplayIcon(); |
* This method sets the large icon useed in the jTabbedPane for this chooser |
97 |
|
* panel. |
98 |
/** |
* |
99 |
* installChooserPanel |
* @return The large icon. |
100 |
* @param chooser TODO |
*/ |
101 |
*/ |
public abstract Icon getLargeDisplayIcon(); |
102 |
public void installChooserPanel(JColorChooser chooser) { |
|
103 |
// TODO |
/** |
104 |
} // installChooserPanel() |
* This method installs the chooser panel for the given JColorChooser. |
105 |
|
* |
106 |
/** |
* @param chooser The JColorChooser that will have this panel installed. |
107 |
* uninstallChooserPanel |
*/ |
108 |
* @param chooser TODO |
public void installChooserPanel(JColorChooser chooser) |
109 |
*/ |
{ |
110 |
public void uninstallChooserPanel(JColorChooser chooser) { |
this.chooser = chooser; |
111 |
// TODO |
buildChooser(); |
112 |
} // uninstallChooserPanel() |
} // installChooserPanel() |
113 |
|
|
114 |
/** |
/** |
115 |
* getColorSelectionModel |
* This method removes the chooser panel from the given JColorChooser and |
116 |
* @returns ColorSelectionModel |
* does any necessary clean up for the chooser panel. |
117 |
*/ |
* |
118 |
public ColorSelectionModel getColorSelectionModel() { |
* @param chooser The JColorChooser that is having this panel removed. |
119 |
return null; // TODO |
*/ |
120 |
} // getColorSelectionModel() |
public void uninstallChooserPanel(JColorChooser chooser) |
121 |
|
{ |
122 |
/** |
this.chooser = null; |
123 |
* getColorFromModel |
} // uninstallChooserPanel() |
124 |
* @returns Color |
|
125 |
*/ |
/** |
126 |
protected Color getColorFromModel() { |
* This method returns the ColorSelectionModel for the JColorChooser |
127 |
return null; // TODO |
* associated with this chooser panel. |
128 |
} // getColorFromModel() |
* |
129 |
|
* @return The ColorSelectionModel for the JColorChooser associated with |
130 |
/** |
* this chooser panel. |
131 |
* paint |
*/ |
132 |
* @param graphics TODO |
public ColorSelectionModel getColorSelectionModel() |
133 |
*/ |
{ |
134 |
public void paint(Graphics graphics) { |
if (chooser != null) |
135 |
// TODO |
return chooser.getSelectionModel(); |
136 |
} // paint() |
return null; |
137 |
|
} // getColorSelectionModel() |
138 |
|
|
139 |
|
/** |
140 |
|
* This method returns the current color stored in the model for this |
141 |
|
* chooser panel. |
142 |
|
* |
143 |
|
* @return The current color. |
144 |
|
*/ |
145 |
|
protected Color getColorFromModel() |
146 |
|
{ |
147 |
|
if (chooser != null) |
148 |
|
return chooser.getColor(); |
149 |
|
return null; |
150 |
|
} // getColorFromModel() |
151 |
|
|
152 |
|
/** |
153 |
|
* This method paints the chooser panel. |
154 |
|
* |
155 |
|
* @param graphics The Graphics object to paint with. |
156 |
|
*/ |
157 |
|
public void paint(Graphics graphics) |
158 |
|
{ |
159 |
|
super.paint(graphics); |
160 |
|
} // paint() |
161 |
} // AbstractColorChooserPanel |
} // AbstractColorChooserPanel |