buoy.widget
Class BColorChooser
public class BColorChooser
A BColorChooser is a Widget that allows the user to select a color. It has tabs which provide
various ways of choosing the color, such as selecting one from a palette or specifying values
for hue, saturation, and brightness.
BColorChooser can be used in two different ways. First, it can be added to a container like
any other Widget. This is useful when you want it to appear inside of a window along with
other Widgets.
Most often, however, BColorChooser is used in a modal dialog as a self contained user interface
element. To use it this way, you simply instantiate a BColorChooser, set any properties, and then
call
showDialog()
to display it.
showDialog()
will
automatically create a dialog, add the BColorChooser, display it, and block until the user
dismisses the dialog. You can reuse a single BColorChooser by repeatedly calling
showDialog()
.
In addition to the event types generated by all Widgets, BColorChoosers generate the following event types:
BColorChooser() - Create a new BColorChooser whose initial color is white.
|
BColorChooser(Color color, String title) - Create a new BColorChooser
|
Color | getColor() - Get the color selected in the BColorChooser.
|
String | getTitle() - Get the title displayed on the dialog.
|
void | setColor(Color color) - Set the color selected in the BColorChooser.
|
void | setTitle(String title) - Set the title displayed on the dialog.
|
boolean | showDialog(Widget parent) - Show a dialog containing this BColorChooser and block until the user closes it.
|
addEventLink , dispatchEvent , getBackground , getBounds , getComponent , getCursor , getFont , getMaximumSize , getMinimumSize , getName , getParent , getPreferredSize , hasFocus , isEnabled , isFocusable , isVisible , repaint , requestFocus , setBackground , setCursor , setEnabled , setFocusable , setFont , setName , setVisible |
BColorChooser
public BColorChooser()
Create a new BColorChooser whose initial color is white.
BColorChooser
public BColorChooser(Color color,
String title)
Create a new BColorChooser
color
- the color which is initially selectedtitle
- the title to display on the dialog
getColor
public Color getColor()
Get the color selected in the BColorChooser.
getTitle
public String getTitle()
Get the title displayed on the dialog.
setColor
public void setColor(Color color)
Set the color selected in the BColorChooser.
setTitle
public void setTitle(String title)
Set the title displayed on the dialog.
showDialog
public boolean showDialog(Widget parent)
Show a dialog containing this BColorChooser and block until the user closes it. After this method
returns, you can call getColor()
to determine what color was selected.
parent
- the dialog's parent Widget (usually a WindowWidget). This may be null.
- true if the user clicked the OK button, false if they clicked the cancel button
Written by Peter Eastman.