jdk/src/share/classes/javax/swing/JColorChooser.java
Print this page
*** 20,44 ****
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-
package javax.swing;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
import javax.swing.colorchooser.*;
import javax.swing.plaf.ColorChooserUI;
import javax.accessibility.*;
import sun.swing.SwingUtilities2;
-
/**
* <code>JColorChooser</code> provides a pane of controls designed to allow
* a user to manipulate and select a color.
* For information about using color choosers, see
* <a
--- 20,44 ----
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javax.swing;
import java.awt.*;
import java.awt.event.*;
+ import java.beans.JavaBean;
+ import java.beans.BeanProperty;
import java.io.*;
import java.util.*;
import javax.swing.colorchooser.*;
import javax.swing.plaf.ColorChooserUI;
import javax.accessibility.*;
import sun.swing.SwingUtilities2;
/**
* <code>JColorChooser</code> provides a pane of controls designed to allow
* a user to manipulate and select a color.
* For information about using color choosers, see
* <a
*** 71,91 ****
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
- *
- * @beaninfo
- * attribute: isContainer false
- * description: A component that supports selecting a Color.
- *
- *
* @author James Gosling
* @author Amy Fowler
* @author Steve Wilson
* @since 1.2
*/
@SuppressWarnings("serial") // Same-version serialization only
public class JColorChooser extends JComponent implements Accessible {
/**
* @see #getUIClassID
--- 71,87 ----
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
* @author James Gosling
* @author Amy Fowler
* @author Steve Wilson
* @since 1.2
*/
+ @JavaBean(defaultProperty = "UI", description = "A component that supports selecting a Color.")
+ @SwingContainer(false)
@SuppressWarnings("serial") // Same-version serialization only
public class JColorChooser extends JComponent implements Accessible {
/**
* @see #getUIClassID
*** 230,245 ****
/**
* Sets the L&F object that renders this component.
*
* @param ui the <code>ColorChooserUI</code> L&F object
* @see UIDefaults#getUI
- *
- * @beaninfo
- * bound: true
- * hidden: true
- * description: The UI object that implements the color chooser's LookAndFeel.
*/
public void setUI(ColorChooserUI ui) {
super.setUI(ui);
}
/**
--- 226,238 ----
/**
* Sets the L&F object that renders this component.
*
* @param ui the <code>ColorChooserUI</code> L&F object
* @see UIDefaults#getUI
*/
+ @BeanProperty(hidden = true, description
+ = "The UI object that implements the color chooser's LookAndFeel.")
public void setUI(ColorChooserUI ui) {
super.setUI(ui);
}
/**
*** 258,267 ****
--- 251,261 ----
*
* @return the string "ColorChooserUI"
* @see JComponent#getUIClassID
* @see UIDefaults#getUI
*/
+ @BeanProperty(bound = false)
public String getUIClassID() {
return uiClassID;
}
/**
*** 277,292 ****
/**
* Sets the current color of the color chooser to the specified color.
* The <code>ColorSelectionModel</code> will fire a <code>ChangeEvent</code>
* @param color the color to be set in the color chooser
* @see JComponent#addPropertyChangeListener
- *
- * @beaninfo
- * bound: false
- * hidden: false
- * description: The current color the chooser is to display.
*/
public void setColor(Color color) {
selectionModel.setSelectedColor(color);
}
--- 271,283 ----
/**
* Sets the current color of the color chooser to the specified color.
* The <code>ColorSelectionModel</code> will fire a <code>ChangeEvent</code>
* @param color the color to be set in the color chooser
* @see JComponent#addPropertyChangeListener
*/
+ @BeanProperty(bound = false, description
+ = "The current color the chooser is to display.")
public void setColor(Color color) {
selectionModel.setSelectedColor(color);
}
*** 350,364 ****
*
* @see java.awt.GraphicsEnvironment#isHeadless
* @see #getDragEnabled
* @see #setTransferHandler
* @see TransferHandler
- *
- * @beaninfo
- * description: Determines whether automatic drag handling is enabled.
- * bound: false
*/
public void setDragEnabled(boolean b) {
if (b && GraphicsEnvironment.isHeadless()) {
throw new HeadlessException();
}
dragEnabled = b;
--- 341,353 ----
*
* @see java.awt.GraphicsEnvironment#isHeadless
* @see #getDragEnabled
* @see #setTransferHandler
* @see TransferHandler
*/
+ @BeanProperty(bound = false, description
+ = "Determines whether automatic drag handling is enabled.")
public void setDragEnabled(boolean b) {
if (b && GraphicsEnvironment.isHeadless()) {
throw new HeadlessException();
}
dragEnabled = b;
*** 380,395 ****
* This will fire a <code>PropertyChangeEvent</code> for the property
* named "previewPanel".
*
* @param preview the <code>JComponent</code> which displays the current color
* @see JComponent#addPropertyChangeListener
- *
- * @beaninfo
- * bound: true
- * hidden: true
- * description: The UI component which displays the current color.
*/
public void setPreviewPanel(JComponent preview) {
if (previewPanel != preview) {
JComponent oldPreview = previewPanel;
previewPanel = preview;
--- 369,381 ----
* This will fire a <code>PropertyChangeEvent</code> for the property
* named "previewPanel".
*
* @param preview the <code>JComponent</code> which displays the current color
* @see JComponent#addPropertyChangeListener
*/
+ @BeanProperty(hidden = true, description
+ = "The UI component which displays the current color.")
public void setPreviewPanel(JComponent preview) {
if (previewPanel != preview) {
JComponent oldPreview = previewPanel;
previewPanel = preview;
*** 465,480 ****
/**
* Specifies the Color Panels used to choose a color value.
*
* @param panels an array of <code>AbstractColorChooserPanel</code>
* objects
- *
- * @beaninfo
- * bound: true
- * hidden: true
- * description: An array of different chooser types.
*/
public void setChooserPanels( AbstractColorChooserPanel[] panels) {
AbstractColorChooserPanel[] oldValue = chooserPanels;
chooserPanels = panels;
firePropertyChange(CHOOSER_PANELS_PROPERTY, oldValue, panels);
}
--- 451,463 ----
/**
* Specifies the Color Panels used to choose a color value.
*
* @param panels an array of <code>AbstractColorChooserPanel</code>
* objects
*/
+ @BeanProperty(hidden = true, description
+ = "An array of different chooser types.")
public void setChooserPanels( AbstractColorChooserPanel[] panels) {
AbstractColorChooserPanel[] oldValue = chooserPanels;
chooserPanels = panels;
firePropertyChange(CHOOSER_PANELS_PROPERTY, oldValue, panels);
}
*** 500,515 ****
/**
* Sets the model containing the selected color.
*
* @param newModel the new <code>ColorSelectionModel</code> object
- *
- * @beaninfo
- * bound: true
- * hidden: true
- * description: The model which contains the currently selected color.
*/
public void setSelectionModel(ColorSelectionModel newModel ) {
ColorSelectionModel oldModel = selectionModel;
selectionModel = newModel;
firePropertyChange(JColorChooser.SELECTION_MODEL_PROPERTY, oldModel, newModel);
}
--- 483,495 ----
/**
* Sets the model containing the selected color.
*
* @param newModel the new <code>ColorSelectionModel</code> object
*/
+ @BeanProperty(hidden = true, description
+ = "The model which contains the currently selected color.")
public void setSelectionModel(ColorSelectionModel newModel ) {
ColorSelectionModel oldModel = selectionModel;
selectionModel = newModel;
firePropertyChange(JColorChooser.SELECTION_MODEL_PROPERTY, oldModel, newModel);
}
*** 569,578 ****
--- 549,559 ----
* A new AccessibleJColorChooser instance is created if necessary.
*
* @return an AccessibleJColorChooser that serves as the
* AccessibleContext of this JColorChooser
*/
+ @BeanProperty(bound = false)
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleJColorChooser();
}
return accessibleContext;