org.gnu.gtk

Class 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(Handle handle)
For internal use by Java-Gnome only.
ColorButton(Color color)
Create a new ColorButton initialized with the provided color.

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(Handle handle)
For internal use by Java-Gnome only.
Class
getEventListenerClass(String signal)
EventType
getEventType(String signal)
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(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, getEventListenerClass, getEventType, 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, getType

Methods inherited from class org.gnu.gtk.Container

add, addListener, getBorderWidth, getChildren, getEventListenerClass, getEventType, getResizeMode, getType, remove, removeListener, resizeChildren, setBorderWidth, 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, getEventListenerClass, getEventType, getExtensionEvents, getModifierStyle, getName, getParent, getParentWindow, getPointer, getRootWindow, getScreen, getSensitive, getStyle, getToplevel, getType, 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, getType, sink

Methods inherited from class org.gnu.glib.GObject

addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addListener, collect, freezeNotify, getBooleanProperty, getData, getDoubleProperty, getEventListenerClass, getEventType, getFloatProperty, getGObjectFromHandle, getIntProperty, getJavaObjectProperty, getLongProperty, getPixbufProperty, getProperty, getStringProperty, hasProperty, notify, removeEventHandler, removeListener, setBooleanProperty, setData, setDoubleProperty, setFloatProperty, setIntProperty, setJavaObjectProperty, setLongProperty, setPixbufProperty, setProperty, setStringProperty, thawNotify

Constructor Details

ColorButton

public ColorButton()
Create a new ColorButton.

ColorButton

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

ColorButton

public ColorButton(Color color)
Create a new ColorButton initialized with the provided color.
Parameters:
color - A Color to set the current color with.

Method Details

addListener

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

getAlpha

public int getAlpha()
Returns the current alpha value.

getColor

public Color getColor()
Returns the current color value.

getColorButton

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

getEventListenerClass

public Class getEventListenerClass(String signal)
Overrides:
getEventListenerClass in interface Button

getEventType

public EventType getEventType(String signal)
Overrides:
getEventType in interface Button

getTitle

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

getUseAlpha

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

removeListener

public void removeListener(ColorButtonListener listener)
Removes a listener

setAlpha

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

setColor

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

setTitle

public void setTitle(String title)
Sets the color for the ColorSelectionDialog.
Parameters:
title -

setUseAlpha

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