org.gnu.gtk
Class ColorButton

java.lang.Object
  extended by org.gnu.glib.Struct
      extended by org.gnu.glib.GObject
          extended by org.gnu.gtk.GtkObject
              extended by org.gnu.gtk.Widget
                  extended by org.gnu.gtk.Container
                      extended by org.gnu.gtk.Bin
                          extended by org.gnu.gtk.Button
                              extended by org.gnu.gtk.ColorButton

public class ColorButton
extends Button

The ColorButton is a widget in the form of a small button containing a swatch representing the current selected color. When the button is clicked, a ColorSelection dialog will open, allowing the user to select a color. The swatch will be updated to reflect the new color when the user finishes.


Constructor Summary
ColorButton()
          Create a new ColorButton.
ColorButton(Color color)
          Create a new ColorButton initialized with the provided color.
ColorButton(org.gnu.glib.Handle handle)
          For internal use by Java-Gnome only.
 
Method Summary
 void addListener(ColorButtonListener listener)
          Register an object to handle dialog events.
 int getAlpha()
          Returns the current alpha value.
 Color getColor()
          Returns the current color value.
static ColorButton getColorButton(org.gnu.glib.Handle handle)
          For internal use by Java-Gnome only.
 java.lang.Class getEventListenerClass(java.lang.String signal)
           
 EventType getEventType(java.lang.String signal)
           
 java.lang.String getTitle()
          Returns the title from the ColorSelectionDialog.
 boolean getUseAlpha()
          Returns whether or not the ColorButton is using the alpha channel.
 void removeListener(ColorButtonListener listener)
          Removes a listener
 void setAlpha(int alpha)
          Sets the current opacity to be alpha
 void setColor(Color color)
          Set the current color for the widget.
 void setTitle(java.lang.String title)
          Sets the color for the ColorSelectionDialog.
 void setUseAlpha(boolean useAlpha)
          Sets whether or not the ColorButton should use the alpha channel.
 
Methods inherited from class org.gnu.gtk.Button
addListener, click, enter, getButton, getFocusOnClick, getImage, getLabel, getRelief, getType, getUseStock, getUseUnderline, getXAlignment, getYAlignment, leave, press, release, removeListener, setAlignment, setFocusOnClick, setImage, setLabel, setRelief, setUseStock, setUseUnderline
 
Methods inherited from class org.gnu.gtk.Bin
getChild
 
Methods inherited from class org.gnu.gtk.Container
add, addListener, getBooleanChildProperty, getBorderWidth, getChildProperty, getChildren, getIntChildProperty, getResizeMode, remove, removeListener, resizeChildren, setBooleanChildProperty, setBorderWidth, setChildProperty, setIntChildProperty, setResizeMode
 
Methods inherited from class org.gnu.gtk.Widget
activate, addAccelerator, addEvents, addListener, addListener, addListener, addListener, addListener, addListener, addListener, addListener, addListener, addListener, addListener, canActivateAccel, createContext, createLayout, draw, drawArea, drawArea, finish, getAccessible, getAllocation, getCanFocus, getColormap, getContext, getData, getDisplay, getDragData, getExtensionEvents, getModifierStyle, getName, getParent, getParentWindow, getPointer, getRootWindow, getScreen, getSensitive, getStyle, getToplevel, getWidget, getWindow, grabDefault, grabFocus, hasFocus, hasScreen, hide, hideAll, highlight, highlight, intersect, isAncestor, makeWidget, modifyStyle, popColormap, pushColormap, realize, removeAccelerator, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, reparent, setBackgroundColor, setBaseColor, setCanFocus, setColormap, setDoubleBuffered, setDragDestination, setDragIcon, setDragIconPixbuf, setDragIconStock, setDragSource, setEvents, setExtensionEvents, setFont, setForegroundColor, setMinimumSize, setName, setNoDragDestination, setNoDragSource, setSensitive, setTextColor, shapeCombineMask, show, showAll, unHighlight, unHighlight
 
Methods inherited from class org.gnu.gtk.GtkObject
destroy, sink
 
Methods inherited from class org.gnu.glib.GObject
addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addListener, collect, freezeNotify, getBooleanProperty, getData, getDoubleProperty, getFloatProperty, getGObjectFromHandle, getIntProperty, getJavaObjectProperty, getLongProperty, getPixbufProperty, getProperty, getStringProperty, hasProperty, notify, removeEventHandler, removeListener, setBooleanProperty, setData, setDoubleProperty, setFloatProperty, setIntProperty, setJavaObjectProperty, setLongProperty, setPixbufProperty, setProperty, setStringProperty, thawNotify
 
Methods inherited from class org.gnu.glib.Struct
equals, getHandle, getNullHandle, hashCode
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorButton

public ColorButton()
Create a new ColorButton.


ColorButton

public ColorButton(Color color)
Create a new ColorButton initialized with the provided color.

Parameters:
color - A Color to set the current color with.

ColorButton

public ColorButton(org.gnu.glib.Handle handle)
For internal use by Java-Gnome only.

Method Detail

getColorButton

public static ColorButton getColorButton(org.gnu.glib.Handle handle)
For internal use by Java-Gnome only.


setColor

public void setColor(Color color)
Set the current color for the widget.

Parameters:
color -

getColor

public Color getColor()
Returns the current color value.


setAlpha

public void setAlpha(int alpha)
Sets the current opacity to be alpha

Parameters:
alpha -

getAlpha

public int getAlpha()
Returns the current alpha value.


setUseAlpha

public void setUseAlpha(boolean useAlpha)
Sets whether or not the ColorButton should use the alpha channel.

Parameters:
useAlpha -

getUseAlpha

public boolean getUseAlpha()
Returns whether or not the ColorButton is using the alpha channel.


setTitle

public void setTitle(java.lang.String title)
Sets the color for the ColorSelectionDialog.

Parameters:
title -

getTitle

public java.lang.String getTitle()
Returns the title from the ColorSelectionDialog.


addListener

public void addListener(ColorButtonListener listener)
Register an object to handle dialog events.

See Also:
ColorButtonListener

removeListener

public void removeListener(ColorButtonListener listener)
Removes a listener

See Also:
addListener(ColorButtonListener)

getEventListenerClass

public java.lang.Class getEventListenerClass(java.lang.String signal)
Overrides:
getEventListenerClass in class Button

getEventType

public EventType getEventType(java.lang.String signal)
Overrides:
getEventType in class Button