| Methods from java.awt.Component: |
|---|
|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, dispatchEventImpl, doLayout, enable, enable, enableEvents, enableInputMethods, eventTypeEnabled, findNextFocusComponent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, generateName, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getGraphicsConfigurationImpl, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFocusable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFocusable, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setPeer, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, translateEvent, update, validate |
| Method from javax.swing.JColorChooser Detail: |
public void addChooserPanel(AbstractColorChooserPanel panel) {
AbstractColorChooserPanel[] oldPanels = getChooserPanels();
AbstractColorChooserPanel[] newPanels = new AbstractColorChooserPanel[oldPanels.length+1];
System.arraycopy(oldPanels, 0, newPanels, 0, oldPanels.length);
newPanels[newPanels.length-1] = panel;
setChooserPanels(newPanels);
}
Adds a color chooser panel to the color chooser. |
public static JDialog createDialog(Component c,
String title,
boolean modal,
JColorChooser chooserPane,
ActionListener okListener,
ActionListener cancelListener) throws HeadlessException {
Window window = JOptionPane.getWindowForComponent(c);
ColorChooserDialog dialog;
if (window instanceof Frame) {
dialog = new ColorChooserDialog((Frame)window, title, modal, c, chooserPane,
okListener, cancelListener);
} else {
dialog = new ColorChooserDialog((Dialog)window, title, modal, c, chooserPane,
okListener, cancelListener);
}
return dialog;
}
Creates and returns a new dialog containing the specified
ColorChooser pane along with "OK", "Cancel", and "Reset"
buttons. If the "OK" or "Cancel" buttons are pressed, the dialog is
automatically hidden (but not disposed). If the "Reset"
button is pressed, the color-chooser's color will be reset to the
color which was set the last time show was invoked on the
dialog and the dialog will remain showing. |
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleJColorChooser();
}
return accessibleContext;
}
Gets the AccessibleContext associated with this JColorChooser.
For color choosers, the AccessibleContext takes the form of an
AccessibleJColorChooser.
A new AccessibleJColorChooser instance is created if necessary. |
public AbstractColorChooserPanel[] getChooserPanels() {
return chooserPanels;
}
Returns the specified color panels. |
public Color getColor() {
return selectionModel.getSelectedColor();
}
Gets the current color value from the color chooser.
By default, this delegates to the model. |
public boolean getDragEnabled() {
return dragEnabled;
}
Gets the value of the dragEnabled property. |
public JComponent getPreviewPanel() {
return previewPanel;
}
Returns the preview panel that shows a chosen color. |
public ColorSelectionModel getSelectionModel() {
return selectionModel;
}
Returns the data model that handles color selections. |
public ColorChooserUI getUI() {
return (ColorChooserUI)ui;
}
Returns the L&F object that renders this component. |
public String getUIClassID() {
return uiClassID;
}
Returns the name of the L&F class that renders this component. |
protected String paramString() {
StringBuffer chooserPanelsString = new StringBuffer("");
for (int i=0; i< chooserPanels.length; i++) {
chooserPanelsString.append("[" + chooserPanels[i].toString()
+ "]");
}
String previewPanelString = (previewPanel != null ?
previewPanel.toString() : "");
return super.paramString() +
",chooserPanels=" + chooserPanelsString.toString() +
",previewPanel=" + previewPanelString;
}
Returns a string representation of this JColorChooser.
This method
is intended to be used only for debugging purposes, and the
content and format of the returned string may vary between
implementations. The returned string may be empty but may not
be null. |
public AbstractColorChooserPanel removeChooserPanel(AbstractColorChooserPanel panel) {
int containedAt = -1;
for (int i = 0; i < chooserPanels.length; i++) {
if (chooserPanels[i] == panel) {
containedAt = i;
break;
}
}
if (containedAt == -1) {
throw new IllegalArgumentException("chooser panel not in this chooser");
}
AbstractColorChooserPanel[] newArray = new AbstractColorChooserPanel[chooserPanels.length-1];
if (containedAt == chooserPanels.length-1) { // at end
System.arraycopy(chooserPanels, 0, newArray, 0, newArray.length);
}
else if (containedAt == 0) { // at start
System.arraycopy(chooserPanels, 1, newArray, 0, newArray.length);
}
else { // in middle
System.arraycopy(chooserPanels, 0, newArray, 0, containedAt);
System.arraycopy(chooserPanels, containedAt+1,
newArray, containedAt, (chooserPanels.length - containedAt - 1));
}
setChooserPanels(newArray);
return panel;
}
Removes the Color Panel specified. |
public void setChooserPanels(AbstractColorChooserPanel[] panels) {
AbstractColorChooserPanel[] oldValue = chooserPanels;
chooserPanels = panels;
firePropertyChange(CHOOSER_PANELS_PROPERTY, oldValue, panels);
}
Specifies the Color Panels used to choose a color value. |
public void setColor(Color color) {
selectionModel.setSelectedColor(color);
}
Sets the current color of the color chooser to the specified color.
The ColorSelectionModel will fire a ChangeEvent |
public void setColor(int c) {
setColor((c > > 16) & 0xFF, (c > > 8) & 0xFF, c & 0xFF);
}
Sets the current color of the color chooser to the
specified color. |
public void setColor(int r,
int g,
int b) {
setColor(new Color(r,g,b));
}
Sets the current color of the color chooser to the
specified RGB color. Note that the values of red, green,
and blue should be between the numbers 0 and 255, inclusive. |
public void setDragEnabled(boolean b) {
if (b && GraphicsEnvironment.isHeadless()) {
throw new HeadlessException();
}
dragEnabled = b;
}
Sets the dragEnabled property,
which must be true to enable
automatic drag handling (the first part of drag and drop)
on this component.
The transferHandler property needs to be set
to a non-null value for the drag to do
anything. The default value of the dragEnabled
property
is false.
When automatic drag handling is enabled,
most look and feels begin a drag-and-drop operation
when the user presses the mouse button over the preview panel.
Some look and feels might not support automatic drag and drop;
they will ignore this property. You can work around such
look and feels by modifying the component
to directly call the exportAsDrag method of a
TransferHandler. |
public void setPreviewPanel(JComponent preview) {
if (previewPanel != preview) {
JComponent oldPreview = previewPanel;
previewPanel = preview;
firePropertyChange(JColorChooser.PREVIEW_PANEL_PROPERTY, oldPreview, preview);
}
}
Sets the current preview panel.
This will fire a PropertyChangeEvent for the property
named "previewPanel". |
public void setSelectionModel(ColorSelectionModel newModel) {
ColorSelectionModel oldModel = selectionModel;
selectionModel = newModel;
firePropertyChange(JColorChooser.SELECTION_MODEL_PROPERTY, oldModel, newModel);
}
Sets the model containing the selected color. |
public void setUI(ColorChooserUI ui) {
super.setUI(ui);
}
Sets the L&F object that renders this component. |
public static Color showDialog(Component component,
String title,
Color initialColor) throws HeadlessException {
final JColorChooser pane = new JColorChooser(initialColor != null?
initialColor : Color.white);
ColorTracker ok = new ColorTracker(pane);
JDialog dialog = createDialog(component, title, true, pane, ok, null);
dialog.addComponentListener(new ColorChooserDialog.DisposeOnClose());
dialog.show(); // blocks until user brings dialog down...
return ok.getColor();
}
Shows a modal color-chooser dialog and blocks until the
dialog is hidden. If the user presses the "OK" button, then
this method hides/disposes the dialog and returns the selected color.
If the user presses the "Cancel" button or closes the dialog without
pressing "OK", then this method hides/disposes the dialog and returns
null. |
public void updateUI() {
setUI((ColorChooserUI)UIManager.getUI(this));
}
Notification from the UIManager that the L&F has changed.
Replaces the current UI object with the latest version from the
UIManager. |