class org.aswing.JColorChooser extends AbstractColorChooserPanel
JColorChooser
provides a pane of controls designed to allow a user to manipulate and
select a color.
You can add your color chooser pane to the chooser panels' tabbedPane container, or remove defaults. @author paling
Class Fields
static function createDialog(chooser:JColorChooser, component:Component, title:String, ?modal:Bool = true, ?okHandler:Dynamic ->Void = null?cancelHandler:Dynamic ->Void = null): JFrame
Creates a dialog to be the color chooser dialog.
If the user presses the "OK" button, then the dialog will be disposed
and invoke the okHandler(selectedColor:ASColor)
.
If the user presses the "Cancel" button or closes
the dialog without pressing "OK", then the dialog will be disposed and
invoke the cancelHandler()
.
selectedColor
may be null, null means user selected no-color.
This dialog will be default to HIDEONCLOSE, so it can be opened very fast after first openning.
chooser | the color chooser |
component | determines the Frame in which the dialog is displayed; can be null |
title | the title of the box |
(optional)modal | is the window modal, default is true |
(optional)okHandler | the function will be called when user finished the choosing with a specified color. the selected color will be passed to the function as a parammeter. |
(optional)cancelHandler | the function will be called when user canceled the choosing |
returns | the chooser dialog |
static function showDialog(component:Component, title:String, initialColor:ASColor, ?modal:Bool = true, ?okHandler:Dynamic ->Void = null?cancelHandler:Dynamic ->Void = null?location:IntPoint = null): JColorChooser
Shows a modal color-chooser dialog to let user to choose a color.
If the user presses the "OK" button, then the dialog will be disposed
and invoke the okHandler(selectedColor:ASColor)
.
If the user presses the "Cancel" button or closes
the dialog without pressing "OK", then the dialog will be disposed and
invoke the cancelHandler()
.
selectedColor
may be null, null means user selected no-color.
This method always create new Dialog and new JColorChooser, so its openning may performance slowly.
component | determines the Frame in which the dialog is displayed; can be null |
title | the title of the box |
initialColor | the initial color when start choosing |
(optional)modal | is the window modal, default is true |
(optional)okHandler | the function will be called when user finished the choosing with a specified color. the selected color will be passed to the function as a parammeter. |
(optional)cancelHandler | the function will be called when user canceled the choosing |
(optional)location | the location of the dialog to show, default is the center of the screen |
returns | the color chooser |
Instance Fields
function addChooserPanel(tabTitle:String, panel:AbstractColorChooserPanel): Void
Adds a chooser panel to the tabbedPane.
By default, the LAFs implements will add default chooser panels. @see #removeChooserPanel()
tabTitle | the tab title |
panel | the chooser panel |
function getChooserPanelAt(index:Float): AbstractColorChooserPanel
Gets a chooser panel by index from the tabbedPane. @see #addChooserPanel()
index | the index of the chooser panel |
returns | the chooser panel, null means no such index exists. |
function getChooserPanelCount(): Float
Returns the count of chooser panels.
returns | the count of chooser panels. |
function removeChooserPanel(panel:AbstractColorChooserPanel): AbstractColorChooserPanel
Removes a chooser panel from the tabbedPane. @see #addChooserPanel()
panel | the chooser panel to be removed |
returns | the removed chooser panel, null means the panel is not in the tabbedPane. |
function removeChooserPanelAt(index:Float): AbstractColorChooserPanel
Removes a chooser panel by index from the tabbedPane. @see #addChooserPanel()
index | the index of the chooser panel to be removed |
returns | the removed chooser panel, null means no such index exists. |