|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
edu.neu.ccs.gui.DisplayPanel
edu.neu.ccs.gui.VisualColorList
Class VisualColorList displays the named colors
as defined in class Colors
using a square color swatch and 3 labels
with the color name, the RGBA value, and the hex color value.
The class also provides a ColorView so one can
experiment with colors defined by RGBA or hex. In particular,
this permits a user to experiment with colors whose values are
close to some particular named color.
The programmer has some control of the swatch size. See the constants:
MIN_SWATCHDEF_SWATCHMAX_SWATCHThe programmer also has some control of the pane height. See the constants:
MIN_HEIGHTDEF_HEIGHTMAX_HEIGHTAlthough this panel is intended primarily to provide
information to the user, it is possible to use this panel
as a control by querying the ColorView state
or by attaching listeners to the ColorView
that is returned by the method getColorView().
This class replaces an earlier version of the class that
only provided the color names but not the numerical data. The
earlier class also had no embedded ColorView.
ColorView,
MultiColorView,
VisualColorSampler,
Serialized Form| Nested Class Summary |
| Nested classes inherited from class javax.swing.JPanel |
JPanel.AccessibleJPanel |
| Nested classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
private static Border |
BORDER
The standard swatch border. |
private static int |
BORDER_SIZE
The standard border size. |
private JPTScrollPane |
colorPane
The color scroll pane. |
private ColorView |
colorView
The color view for experiments. |
static int |
DEF_HEIGHT
The default height of the viewport of the list scroll pane. |
static int |
DEF_SWATCH
The default swatch size. |
private String[] |
hexArray
The array of color rgba values in hex. |
private static int |
HGAP
The internal table panel horizontal gap. |
static int |
MAX_HEIGHT
The maximum height of the viewport of the list scroll pane. |
static int |
MAX_SWATCH
The maximum swatch size. |
private static int |
MAX_WIDTH
The maximum width of the viewport of the list scroll pane. |
static int |
MIN_HEIGHT
The minimum height of the viewport of the list scroll pane. |
static int |
MIN_SWATCH
The minimum swatch size. |
private String[] |
nameArray
The array of color names. |
private int |
paneHeight
The pane height that must be between MIN_HEIGHT and MAX_HEIGHT. |
private String[] |
rgbaArray
The array of color rgba values. |
private int |
swatchSize
The swatch size that must be between MIN_SWATCH and MAX_SWATCH. |
private static int |
VGAP
The internal table panel vertical gap. |
| Fields inherited from class edu.neu.ccs.gui.DisplayPanel |
background, codec, CODEC |
| Fields inherited from class javax.swing.JPanel |
|
| Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Container |
|
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface edu.neu.ccs.gui.Displayable |
DEFAULT_VIEW_STATE, VIEW_STATE |
| Fields inherited from interface edu.neu.ccs.util.JPTConstants |
ABOVE, ALIGNMENT, BELOW, BOTTOM_LEFT, BOTTOM_RIGHT, DEFAULT, FONT, INPUT_PROPERTIES, MANDATORY, OPTIONAL, ORIENTATION, TOP_LEFT, TOP_RIGHT, VALUE |
| Fields inherited from interface javax.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
VisualColorList()
The constructor that creates a VisualColorList
using a swatch size of 25 and a scroll pane height
of 525. |
|
VisualColorList(int swatchSize)
The constructor that creates a VisualColorList
using the given swatch size and a scroll pane height
of 525. |
|
VisualColorList(int swatchSize,
int paneHeight)
The constructor that creates a VisualColorList
using a the given swatch size and the given scroll
pane height. |
|
| Method Summary | |
private void |
adjustGeometricParameters(int swatchSize,
int paneHeight)
Adjust the geometric parameters. |
private void |
fillStringArrays()
Fill the string arrays of color names, rgba values, and rgba values in hex. |
ColorView |
getColorView()
Returns a reference to the ColorView object
used within this panel. |
static void |
main(String[] args)
|
private JPTScrollPane |
makeColorPane()
Make the scroll pane with named colors. |
private ColorView |
makeColorView()
Make the color view pane for experiments. |
private PaintSwatch |
makeSwatch(String name)
The method to create a swatch based on the given color name and the encapsulated swatch size. |
private TableGenerator |
makeTableGenerator(String[] nameArray,
String[] rgbaArray,
String[] hexArray)
The method to construct the table generator for the color table. |
| Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int MIN_SWATCH
public static final int DEF_SWATCH
public static final int MAX_SWATCH
public static final int MIN_HEIGHT
public static final int DEF_HEIGHT
public static final int MAX_HEIGHT
private static final int MAX_WIDTH
private static final int BORDER_SIZE
private static final Border BORDER
private static final int HGAP
private static final int VGAP
private int swatchSize
private int paneHeight
private String[] nameArray
private String[] rgbaArray
private String[] hexArray
private JPTScrollPane colorPane
private ColorView colorView
| Constructor Detail |
public VisualColorList()
The constructor that creates a VisualColorList
using a swatch size of 25 and a scroll pane height
of 525.
Additional height is used for the color view.
public VisualColorList(int swatchSize)
The constructor that creates a VisualColorList
using the given swatch size and a scroll pane height
of 525.
The swatch size will be forced to the range 20-50 before usage.
Additional height is used for the color view.
swatchSize - the desired swatch size
public VisualColorList(int swatchSize,
int paneHeight)
The constructor that creates a VisualColorList
using a the given swatch size and the given scroll
pane height.
The swatch size will be forced to the range 20-50 before usage.
The pane height will be forced to the range 120-800 before usage.
Additional height is used for the color view.
swatchSize - the desired swatch sizepaneHeight - the desired pane height| Method Detail |
public ColorView getColorView()
Returns a reference to the ColorView object
used within this panel.
Although this panel is intended primarily for user
information, it is possible to use this panel as a control
by querying the ColorView state or
by attaching listeners to the ColorView
that is returned by this method.
private void adjustGeometricParameters(int swatchSize,
int paneHeight)
swatchSize - the desired swatch sizepaneHeight - the desired pane heightprivate void fillStringArrays()
private JPTScrollPane makeColorPane()
private ColorView makeColorView()
private PaintSwatch makeSwatch(String name)
name - a color name in the table in class Colors
private TableGenerator makeTableGenerator(String[] nameArray,
String[] rgbaArray,
String[] hexArray)
nameArray - the array of color namesrgbaArray - the array of color rgba valueshexArray - the array of color rgba values in hex
public static void main(String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||