|
||||||||||
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.AbstractButton
javax.swing.JButton
org.jdesktop.swingx.JXColorSelectionButton
public class JXColorSelectionButton
A button which allows the user to select a single color. The button has a platform specific look. Ex: on Mac OS X it will mimic an NSColorWell. When the user clicks the button it will open a color chooser set to the current background color of the button. The new selected color will be stored in the background property and can be retrieved using the getBackground() method. As the user is choosing colors within the color chooser the background property will be updated. By listening to this property developers can make other parts of their programs update.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JButton |
---|
JButton.AccessibleJButton |
Nested classes/interfaces inherited from class javax.swing.AbstractButton |
---|
AbstractButton.AccessibleAbstractButton, AbstractButton.ButtonChangeListener |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary |
---|
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.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
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 | |
---|---|
JXColorSelectionButton()
Creates a new instance of JXColorSelectionButton |
|
JXColorSelectionButton(Color col)
Creates a new instance of JXColorSelectionButton set to the specified color. |
Method Summary | |
---|---|
JColorChooser |
getChooser()
Get the JColorChooser that is used by this JXColorSelectionButton. |
Dimension |
getPreferredSize()
If the preferredSize has been set to a
non-null value just returns it. |
protected void |
paintComponent(Graphics g)
Calls the UI delegate's paint method, if the UI delegate is non- null . |
void |
setChooser(JColorChooser chooser)
Set the JColorChooser that is used by this JXColorSelectionButton. |
Methods inherited from class javax.swing.JButton |
---|
configurePropertiesFromAction, getAccessibleContext, getUIClassID, isDefaultButton, isDefaultCapable, paramString, removeNotify, setDefaultCapable, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public JXColorSelectionButton()
public JXColorSelectionButton(Color col)
col
- The default colorMethod Detail |
---|
protected void paintComponent(Graphics g)
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.
The passed in Graphics
object might
have a transform other than the identify transform
installed on it. In this case, you might get
unexpected results if you cumulatively apply
another transform.
paintComponent
in class JComponent
g
- the Graphics
object to protectJComponent.paint(java.awt.Graphics)
,
ComponentUI
public JColorChooser getChooser()
public void setChooser(JColorChooser chooser)
chooser
- The new JColorChooser to use.public Dimension getPreferredSize()
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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |