|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel javax.swing.colorchooser.SwatchPanel javax.swing.colorchooser.MainSwatchPanel
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 | |
protected Color[] |
colors
|
protected Dimension |
gap
|
protected Dimension |
numSwatches
|
protected Dimension |
swatchSize
|
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 java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
(package private) |
MainSwatchPanel()
|
Method Summary | |
Color |
getColorForLocation(int x,
int y)
|
Dimension |
getPreferredSize()
If the preferredSize has been set to a
non-null value just returns it.
|
String |
getToolTipText(MouseEvent e)
Returns the string to be used as the tooltip for event. |
protected void |
initColors()
|
private int[] |
initRawValues()
|
protected void |
initValues()
|
boolean |
isFocusTraversable()
Returns whether this Component can become the focus
owner. |
void |
paintComponent(Graphics g)
Calls the UI delegate's paint method, if the UI delegate is non- null . |
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 |
protected Color[] colors
protected Dimension swatchSize
protected Dimension numSwatches
protected Dimension gap
Constructor Detail |
MainSwatchPanel()
Method Detail |
protected void initValues()
initValues
in class SwatchPanel
protected void initColors()
initColors
in class SwatchPanel
private int[] initRawValues()
public boolean isFocusTraversable()
Component
Component
can become the focus
owner.
isFocusTraversable
in class Component
true
if this Component
is
focusable; false
otherwiseComponent.setFocusable(boolean)
public void paintComponent(Graphics g)
JComponent
null
. We pass the delegate a copy of the
Graphics
object to protect the rest of the
paint code from irrevocable changes
(for example, Graphics.translate
).
If you override this in a subclass you should not make permanent
changes to the passed in Graphics
. For example, you
should not alter the clip Rectangle
or modify the
transform. If you need to do these operations you may find it
easier to create a new Graphics
from the passed in
Graphics
and manipulate it. Further, if you do not
invoker super's implementation you must honor the opaque property,
that is
if this component is opaque, you must completely fill in the background
in a non-opaque color. If you do not honor the opaque property you
will likely see visual artifacts.
paintComponent
in class JComponent
g
- the Graphics
object to protectJComponent.paint(java.awt.Graphics)
,
ComponentUI
public Dimension getPreferredSize()
JComponent
preferredSize
has been set to a
non-null
value just returns it.
If the UI delegate's getPreferredSize
method returns a non null
value then return that;
otherwise defer to the component's layout manager.
getPreferredSize
in class JComponent
preferredSize
propertyJComponent.setPreferredSize(java.awt.Dimension)
,
ComponentUI
public String getToolTipText(MouseEvent e)
JComponent
setToolTipText
. If a component provides
more extensive API to support differing tooltips at different locations,
this method should be overridden.
getToolTipText
in class JComponent
public Color getColorForLocation(int x, int y)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |