diff --git a/jdk/make/gensrc/GensrcSwing.gmk b/jdk/make/gensrc/GensrcSwing.gmk index 74b4f8a81dd..2f643d4abc2 100644 --- a/jdk/make/gensrc/GensrcSwing.gmk +++ b/jdk/make/gensrc/GensrcSwing.gmk @@ -41,71 +41,4 @@ $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated_nimbus: $(NIMBUS_SKIN_FI GENSRC_SWING_NIMBUS := $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated_nimbus -# -# Generate beaninfo java files -# - -BEANINFO_OUTPUTDIR := $(SUPPORT_OUTPUTDIR)/gensrc_no_docs/java.desktop -DOCLET_DATA_DIR := $(JDK_TOPDIR)/make/data/swingbeaninfo - -# javax.swing package -BEANS = AbstractButton Box JComponent JApplet JButton \ - JCheckBox JCheckBoxMenuItem JComboBox JColorChooser \ - JDesktopPane JDialog JEditorPane JFileChooser JFrame \ - JFormattedTextField JInternalFrame JLabel JLayeredPane \ - JList JMenu JMenuBar JMenuItem JOptionPane JPanel \ - JPasswordField JPopupMenu JProgressBar JRadioButton \ - JRadioButtonMenuItem JScrollBar JScrollPane JSeparator \ - JSlider JSplitPane JSpinner JTabbedPane JTable \ - JTextArea JTextField JTextPane JToggleButton JToolBar \ - JTree JWindow - -# javax.swing.text package -BEANS_TEXT = JTextComponent - -BEANS_SRC = $(BEANS:%=$(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing/%.java) \ - $(BEANS_TEXT:%=$(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing/text/%.java) - -# Dummy variable so far, in the old build system it was false by default -SWINGBEAN_DEBUG_FLAG = false -# GenDocletBeanInfo is compiled in Tools.gmk and picks up from $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes -# LocaleDataMetaInfo needs to be generated before running this to avoid confusing errors -# in the build log. -$(BEANINFO_OUTPUTDIR)/_the.generated_beaninfo: $(BEANS_SRC) \ - $(BEANINFO_OUTPUTDIR)/javax/swing/SwingBeanInfoBase.java \ - $(BEANINFO_OUTPUTDIR)/sun/swing/BeanInfoUtils.java $(BUILD_TOOLS_JDK) - $(ECHO) Generating beaninfo - $(MKDIR) -p $(BEANINFO_OUTPUTDIR)/javax/swing - $(JAVA) -Djava.awt.headless=true $(NEW_JAVADOC) \ - -sourcepath $(call PathList,\ - $(wildcard $(JDK_TOPDIR)/src/*/*/classes) \ - $(SUPPORT_OUTPUTDIR)/gensrc/java.base) \ - -doclet build.tools.swingbeaninfo.GenDocletBeanInfo \ - -x $(SWINGBEAN_DEBUG_FLAG) -d $(BEANINFO_OUTPUTDIR)/javax/swing \ - -t $(DOCLET_DATA_DIR)/SwingBeanInfo.template \ - -docletpath $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \ - -XDignore.symbol.file=true \ - -classpath $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes $(BEANS_SRC) $(LOG_INFO) - # Move the JTextComponent into its proper package directory. - $(MKDIR) -p $(BEANINFO_OUTPUTDIR)/javax/swing/text - $(MV) $(BEANINFO_OUTPUTDIR)/javax/swing/JTextComponentBeanInfo.java \ - $(BEANINFO_OUTPUTDIR)/javax/swing/text/JTextComponentBeanInfo.java - $(TOUCH) $@ - -# This file is the part of dt.jar -# For some reason it is under $(JDK_TOPDIR)/make/data/swingbeaninfo -# Should it be moved under $(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing instead? -$(BEANINFO_OUTPUTDIR)/javax/swing/SwingBeanInfoBase.java: \ - $(DOCLET_DATA_DIR)/javax/swing/SwingBeanInfoBase.java - $(call install-file) - -# This file is the part of dt.jar -# For some reason it is under $(JDK_TOPDIR)/make/data/swingbeaninfo -# Should it be moved under $(JDK_TOPDIR)/src/java.desktop/share/classes/sun/swing instead? -$(BEANINFO_OUTPUTDIR)/sun/swing/BeanInfoUtils.java: \ - $(DOCLET_DATA_DIR)/sun/swing/BeanInfoUtils.java - $(call install-file) - -GENSRC_SWING_BEANINFO = $(BEANINFO_OUTPUTDIR)/_the.generated_beaninfo - -GENSRC_JAVA_DESKTOP += $(GENSRC_SWING_BEANINFO) $(GENSRC_SWING_NIMBUS) +GENSRC_JAVA_DESKTOP += $(GENSRC_SWING_NIMBUS) diff --git a/jdk/src/java.desktop/share/classes/java/awt/Button.java b/jdk/src/java.desktop/share/classes/java/awt/Button.java index 5c92ce22486..faa8068cf8c 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/Button.java +++ b/jdk/src/java.desktop/share/classes/java/awt/Button.java @@ -26,6 +26,7 @@ package java.awt; import java.awt.peer.ButtonPeer; +import java.beans.BeanProperty; import java.util.EventListener; import java.awt.event.*; import java.io.ObjectOutputStream; @@ -511,11 +512,10 @@ public class Button extends Component implements Accessible { * * @return an AccessibleAWTButton that serves as the * AccessibleContext of this Button - * @beaninfo - * expert: true - * description: The AccessibleContext associated with this Button. * @since 1.3 */ + @BeanProperty(expert = true, description + = "The AccessibleContext associated with this Button.") public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleAWTButton(); diff --git a/jdk/src/java.desktop/share/classes/java/awt/Component.java b/jdk/src/java.desktop/share/classes/java/awt/Component.java index 87bab7eac20..3c50dceecce 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/Component.java +++ b/jdk/src/java.desktop/share/classes/java/awt/Component.java @@ -1763,8 +1763,6 @@ public abstract class Component implements ImageObserver, MenuContainer, * is returned * @see #setForeground * @since 1.0 - * @beaninfo - * bound: true */ @Transient public Color getForeground() { @@ -1843,8 +1841,6 @@ public abstract class Component implements ImageObserver, MenuContainer, * component will inherit the background color of its parent * @see #getBackground * @since 1.0 - * @beaninfo - * bound: true */ public void setBackground(Color c) { Color oldColor = background; @@ -1911,8 +1907,6 @@ public abstract class Component implements ImageObserver, MenuContainer, * @see #getFont * @see #invalidate * @since 1.0 - * @beaninfo - * bound: true */ public void setFont(Font f) { Font oldFont, newFont; @@ -7234,8 +7228,6 @@ public abstract class Component implements ImageObserver, MenuContainer, * @param focusable indicates whether this Component is focusable * @see #isFocusable * @since 1.4 - * @beaninfo - * bound: true */ public void setFocusable(boolean focusable) { boolean oldFocusable; @@ -7327,8 +7319,6 @@ public abstract class Component implements ImageObserver, MenuContainer, * or if any keystroke already maps to another focus traversal * operation for this Component * @since 1.4 - * @beaninfo - * bound: true */ public void setFocusTraversalKeys(int id, Set keystrokes) @@ -7479,8 +7469,6 @@ public abstract class Component implements ImageObserver, MenuContainer, * @see #setFocusTraversalKeys * @see #getFocusTraversalKeys * @since 1.4 - * @beaninfo - * bound: true */ public void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) { @@ -8995,8 +8983,6 @@ public abstract class Component implements ImageObserver, MenuContainer, * @see #invalidate * * @author Laura Werner, IBM - * @beaninfo - * bound: true */ public void setComponentOrientation(ComponentOrientation o) { ComponentOrientation oldValue = componentOrientation; diff --git a/jdk/src/java.desktop/share/classes/java/awt/Container.java b/jdk/src/java.desktop/share/classes/java/awt/Container.java index 6e19e26c5d5..f3e7b3b5d6e 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/Container.java +++ b/jdk/src/java.desktop/share/classes/java/awt/Container.java @@ -3131,8 +3131,6 @@ public class Container extends Component { * or if any keystroke already maps to another focus traversal * operation for this Container * @since 1.4 - * @beaninfo - * bound: true */ public void setFocusTraversalKeys(int id, Set keystrokes) @@ -3347,8 +3345,6 @@ public class Container extends Component { * @see #setFocusCycleRoot * @see #isFocusCycleRoot * @since 1.4 - * @beaninfo - * bound: true */ public void setFocusTraversalPolicy(FocusTraversalPolicy policy) { FocusTraversalPolicy oldPolicy; @@ -3427,8 +3423,6 @@ public class Container extends Component { * @see ContainerOrderFocusTraversalPolicy * @see #setFocusTraversalPolicyProvider * @since 1.4 - * @beaninfo - * bound: true */ public void setFocusCycleRoot(boolean focusCycleRoot) { boolean oldFocusCycleRoot; @@ -3472,8 +3466,6 @@ public class Container extends Component { * @see #getFocusTraversalPolicy * @see #isFocusTraversalPolicyProvider * @since 1.5 - * @beaninfo - * bound: true */ public final void setFocusTraversalPolicyProvider(boolean provider) { boolean oldProvider; @@ -3499,8 +3491,6 @@ public class Container extends Component { * @return true if this container provides focus traversal * policy, false otherwise * @since 1.5 - * @beaninfo - * bound: true */ public final boolean isFocusTraversalPolicyProvider() { return focusTraversalPolicyProvider; diff --git a/jdk/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java b/jdk/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java index 7f1c6dcd88a..75cf0e0c918 100644 --- a/jdk/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java +++ b/jdk/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java @@ -528,8 +528,6 @@ public abstract class KeyboardFocusManager * current KeyboardFocusManager for the calling thread's context * and if the calling thread does not have "replaceKeyboardFocusManager" * permission - * @beaninfo - * bound: true */ protected void setGlobalFocusOwner(Component focusOwner) throws SecurityException @@ -744,8 +742,6 @@ public abstract class KeyboardFocusManager * current KeyboardFocusManager for the calling thread's context * and if the calling thread does not have "replaceKeyboardFocusManager" * permission - * @beaninfo - * bound: true */ protected void setGlobalPermanentFocusOwner(Component permanentFocusOwner) throws SecurityException @@ -847,8 +843,6 @@ public abstract class KeyboardFocusManager * current KeyboardFocusManager for the calling thread's context * and if the calling thread does not have "replaceKeyboardFocusManager" * permission - * @beaninfo - * bound: true */ protected void setGlobalFocusedWindow(Window focusedWindow) throws SecurityException @@ -952,8 +946,6 @@ public abstract class KeyboardFocusManager * current KeyboardFocusManager for the calling thread's context * and if the calling thread does not have "replaceKeyboardFocusManager" * permission - * @beaninfo - * bound: true */ protected void setGlobalActiveWindow(Window activeWindow) throws SecurityException @@ -1008,8 +1000,6 @@ public abstract class KeyboardFocusManager * @see Container#setFocusTraversalPolicy * @see Container#getFocusTraversalPolicy * @throws IllegalArgumentException if defaultPolicy is null - * @beaninfo - * bound: true */ public void setDefaultFocusTraversalPolicy(FocusTraversalPolicy defaultPolicy) { @@ -1113,8 +1103,6 @@ public abstract class KeyboardFocusManager * represents a {@code KEY_TYPED} event, * or if any keystroke already maps * to another default focus traversal operation - * @beaninfo - * bound: true */ public void setDefaultFocusTraversalKeys(int id, @@ -1272,8 +1260,6 @@ public abstract class KeyboardFocusManager * @see #getGlobalCurrentFocusCycleRoot * @throws SecurityException if the calling thread does not have * "replaceKeyboardFocusManager" permission - * @beaninfo - * bound: true */ public void setGlobalCurrentFocusCycleRoot(Container newFocusCycleRoot) throws SecurityException diff --git a/jdk/src/java.desktop/share/classes/java/beans/SimpleBeanInfo.java b/jdk/src/java.desktop/share/classes/java/beans/SimpleBeanInfo.java index 20d23127cdf..ddef0cffad5 100644 --- a/jdk/src/java.desktop/share/classes/java/beans/SimpleBeanInfo.java +++ b/jdk/src/java.desktop/share/classes/java/beans/SimpleBeanInfo.java @@ -28,6 +28,8 @@ package java.beans; import java.awt.Image; import java.awt.Toolkit; import java.io.InputStream; +import java.security.AccessController; +import java.security.PrivilegedAction; /** * This is a support class to make it easier for people to provide @@ -41,13 +43,13 @@ import java.io.InputStream; * * @since 1.1 */ - public class SimpleBeanInfo implements BeanInfo { /** * Deny knowledge about the class and customizer of the bean. * You can override this if you wish to provide explicit info. */ + @Override public BeanDescriptor getBeanDescriptor() { return null; } @@ -56,6 +58,7 @@ public class SimpleBeanInfo implements BeanInfo { * Deny knowledge of properties. You can override this * if you wish to provide explicit property info. */ + @Override public PropertyDescriptor[] getPropertyDescriptors() { return null; } @@ -64,6 +67,7 @@ public class SimpleBeanInfo implements BeanInfo { * Deny knowledge of a default property. You can override this * if you wish to define a default property for the bean. */ + @Override public int getDefaultPropertyIndex() { return -1; } @@ -72,6 +76,7 @@ public class SimpleBeanInfo implements BeanInfo { * Deny knowledge of event sets. You can override this * if you wish to provide explicit event set info. */ + @Override public EventSetDescriptor[] getEventSetDescriptors() { return null; } @@ -80,6 +85,7 @@ public class SimpleBeanInfo implements BeanInfo { * Deny knowledge of a default event. You can override this * if you wish to define a default event for the bean. */ + @Override public int getDefaultEventIndex() { return -1; } @@ -88,6 +94,7 @@ public class SimpleBeanInfo implements BeanInfo { * Deny knowledge of methods. You can override this * if you wish to provide explicit method info. */ + @Override public MethodDescriptor[] getMethodDescriptors() { return null; } @@ -97,6 +104,7 @@ public class SimpleBeanInfo implements BeanInfo { * may override this if you want to (for example) return a * BeanInfo for a base class. */ + @Override public BeanInfo[] getAdditionalBeanInfo() { return null; } @@ -105,10 +113,63 @@ public class SimpleBeanInfo implements BeanInfo { * Claim there are no icons available. You can override * this if you want to provide icons for your bean. */ - public Image getIcon(int iconKind) { + @Override + public Image getIcon(final int iconKind) { + final BeanDescriptor descriptor = getBeanDescriptor(); + if (descriptor != null) { + final Class type = descriptor.getBeanClass(); + if (type != null && type.getClassLoader() == null + && type.getAnnotation(JavaBean.class) != null) { + final String name = type.getName(); + final int index = name.lastIndexOf('.'); + if (name.substring(0, index).equals("javax.swing")) { + final String className = type.getSimpleName(); + switch (iconKind) { + case ICON_COLOR_32x32: + return loadImage(className, "Color32.gif"); + case ICON_COLOR_16x16: + return loadImage(className, "Color16.gif"); + case ICON_MONO_32x32: + return loadImage(className, "Mono32.gif"); + case ICON_MONO_16x16: + return loadImage(className, "Mono16.gif"); + } + } + } + } return null; } + /** + * This is a utility method to help in loading standard icon images. + * + * @param resourceName A pathname relative to the directory holding the + * class file of the current class + * @return an image object. May be null if the load failed. + * @see java.beans.SimpleBeanInfo#loadImage(String) + */ + private Image loadStandardImage(final String resourceName) { + return AccessController.doPrivileged( + (PrivilegedAction) () -> loadImage(resourceName)); + } + + /** + * This is a utility method to help in loading standard icon images. + * + * @param resourceName A pathname relative to the directory holding the + * class file of the current class + * @param suffix A {@code String} containing a file suffix (e.g., + * "Color32.gif" or "Mono32.gif") + * @return an image object. May be null if the load failed. + * @see java.beans.SimpleBeanInfo#loadImage(String) + */ + private Image loadImage(final String resourceName, final String suffix) { + final String prefix = "/javax/swing/beaninfo/images/"; + final Image image = loadStandardImage(prefix + resourceName + suffix); + return image == null ? loadStandardImage(prefix + "JComponent" + suffix) + : image; + } + /** * This is a utility method to help in loading icon images. * It takes the name of a resource file associated with the diff --git a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleContext.java b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleContext.java index b7f584b95db..65a163fa4ca 100644 --- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleContext.java +++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,11 +29,15 @@ import sun.awt.AWTAccessor; import sun.awt.AppContext; import java.util.Locale; +import java.beans.JavaBean; +import java.beans.BeanProperty; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.beans.PropertyChangeEvent; import java.awt.IllegalComponentStateException; +import javax.swing.SwingContainer; + /** * AccessibleContext represents the minimum information all accessible objects * return. This information includes the accessible name, description, role, @@ -69,17 +73,13 @@ import java.awt.IllegalComponentStateException; * minimum and maximum values. Any object that supports a numerical value * should support this interface. * - * - * @beaninfo - * attribute: isContainer false - * description: Minimal information that all accessible objects return - * - * @author Peter Korn * @author Hans Muller * @author Willie Walker * @author Lynn Monsanto */ +@JavaBean(description = "Minimal information that all accessible objects return") +@SwingContainer(false) public abstract class AccessibleContext { /** @@ -447,11 +447,9 @@ public abstract class AccessibleContext { * * @see #getAccessibleName * @see #addPropertyChangeListener - * - * @beaninfo - * preferred: true - * description: Sets the accessible name for the component. */ + @BeanProperty(preferred = true, description + = "Sets the accessible name for the component.") public void setAccessibleName(String s) { String oldName = accessibleName; accessibleName = s; @@ -483,11 +481,9 @@ public abstract class AccessibleContext { * * @see #setAccessibleName * @see #addPropertyChangeListener - * - * @beaninfo - * preferred: true - * description: Sets the accessible description for the component. */ + @BeanProperty(preferred = true, description + = "Sets the accessible description for the component.") public void setAccessibleDescription(String s) { String oldDescription = accessibleDescription; accessibleDescription = s; diff --git a/jdk/src/java.desktop/share/classes/javax/swing/AbstractButton.java b/jdk/src/java.desktop/share/classes/javax/swing/AbstractButton.java index 89da3cf30c9..64ac496c509 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/AbstractButton.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/AbstractButton.java @@ -26,23 +26,19 @@ package javax.swing; import java.awt.*; import java.awt.event.*; -import java.awt.image.*; import java.text.*; import java.awt.geom.*; +import java.beans.JavaBean; +import java.beans.BeanProperty; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.beans.Transient; import java.util.Enumeration; -import java.util.Vector; import java.io.Serializable; import javax.swing.event.*; -import javax.swing.border.*; import javax.swing.plaf.*; import javax.accessibility.*; import javax.swing.text.*; -import javax.swing.text.html.*; -import javax.swing.plaf.basic.*; -import java.util.*; /** * Defines common behaviors for buttons and menu items. @@ -73,6 +69,7 @@ import java.util.*; * @author Jeff Dinkins * @since 1.2 */ +@JavaBean(defaultProperty = "UI") @SuppressWarnings("serial") // Same-version serialization only public abstract class AbstractButton extends JComponent implements ItemSelectable, SwingConstants { @@ -251,12 +248,9 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * @see Swing Components Supporting * Action * @since 1.6 - * @beaninfo - * bound: true - * expert: true - * description: Whether the text of the button should come from - * the Action. */ + @BeanProperty(expert = true, description + = "Whether the text of the button should come from the Action.") public void setHideActionText(boolean hideActionText) { if (hideActionText != this.hideActionText) { this.hideActionText = hideActionText; @@ -296,12 +290,9 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * Sets the button's text. * @param text the string used to set the text * @see #getText - * @beaninfo - * bound: true - * preferred: true - * attribute: visualUpdate true - * description: The button's text. */ + @BeanProperty(preferred = true, visualUpdate = true, description + = "The button's text.") public void setText(String text) { String oldValue = this.text; this.text = text; @@ -390,12 +381,9 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * effectively be ignored). * * @param m the space between the border and the label - * - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: The space between the button's border and the label. */ + @BeanProperty(visualUpdate = true, description + = "The space between the button's border and the label.") public void setMargin(Insets m) { // Cache the old margin if it comes from the UI if(m instanceof UIResource) { @@ -448,11 +436,9 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * @param defaultIcon the icon used as the default image * @see #getIcon * @see #setPressedIcon - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: The button's default icon */ + @BeanProperty(visualUpdate = true, description + = "The button's default icon") public void setIcon(Icon defaultIcon) { Icon oldValue = this.defaultIcon; this.defaultIcon = defaultIcon; @@ -495,11 +481,9 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * Sets the pressed icon for the button. * @param pressedIcon the icon used as the "pressed" image * @see #getPressedIcon - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: The pressed icon for the button. */ + @BeanProperty(visualUpdate = true, description + = "The pressed icon for the button.") public void setPressedIcon(Icon pressedIcon) { Icon oldValue = this.pressedIcon; this.pressedIcon = pressedIcon; @@ -529,11 +513,9 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * Sets the selected icon for the button. * @param selectedIcon the icon used as the "selected" image * @see #getSelectedIcon - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: The selected icon for the button. */ + @BeanProperty(visualUpdate = true, description + = "The selected icon for the button.") public void setSelectedIcon(Icon selectedIcon) { Icon oldValue = this.selectedIcon; this.selectedIcon = selectedIcon; @@ -575,11 +557,9 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * Sets the rollover icon for the button. * @param rolloverIcon the icon used as the "rollover" image * @see #getRolloverIcon - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: The rollover icon for the button. */ + @BeanProperty(visualUpdate = true, description + = "The rollover icon for the button.") public void setRolloverIcon(Icon rolloverIcon) { Icon oldValue = this.rolloverIcon; this.rolloverIcon = rolloverIcon; @@ -612,11 +592,9 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * @param rolloverSelectedIcon the icon used as the * "selected rollover" image * @see #getRolloverSelectedIcon - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: The rollover selected icon for the button. */ + @BeanProperty(visualUpdate = true, description + = "The rollover selected icon for the button.") public void setRolloverSelectedIcon(Icon rolloverSelectedIcon) { Icon oldValue = this.rolloverSelectedIcon; this.rolloverSelectedIcon = rolloverSelectedIcon; @@ -664,11 +642,9 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * Sets the disabled icon for the button. * @param disabledIcon the icon used as the disabled image * @see #getDisabledIcon - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: The disabled icon for the button. */ + @BeanProperty(visualUpdate = true, description + = "The disabled icon for the button.") public void setDisabledIcon(Icon disabledIcon) { Icon oldValue = this.disabledIcon; this.disabledIcon = disabledIcon; @@ -717,11 +693,9 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * @param disabledSelectedIcon the icon used as the disabled * selection image * @see #getDisabledSelectedIcon - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: The disabled selection icon for the button. */ + @BeanProperty(visualUpdate = true, description + = "The disabled selection icon for the button.") public void setDisabledSelectedIcon(Icon disabledSelectedIcon) { Icon oldValue = this.disabledSelectedIcon; this.disabledSelectedIcon = disabledSelectedIcon; @@ -768,14 +742,12 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * * @throws IllegalArgumentException if the alignment is not one of the legal * values listed above - * @beaninfo - * bound: true - * enum: TOP SwingConstants.TOP - * CENTER SwingConstants.CENTER - * BOTTOM SwingConstants.BOTTOM - * attribute: visualUpdate true - * description: The vertical alignment of the icon and text. */ + @BeanProperty(visualUpdate = true, enumerationValues = { + "SwingConstants.TOP", + "SwingConstants.CENTER", + "SwingConstants.BOTTOM"}, description + = "The vertical alignment of the icon and text.") public void setVerticalAlignment(int alignment) { if (alignment == verticalAlignment) return; int oldValue = verticalAlignment; @@ -817,16 +789,14 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * * @throws IllegalArgumentException if the alignment is not one of the * valid values - * @beaninfo - * bound: true - * enum: LEFT SwingConstants.LEFT - * CENTER SwingConstants.CENTER - * RIGHT SwingConstants.RIGHT - * LEADING SwingConstants.LEADING - * TRAILING SwingConstants.TRAILING - * attribute: visualUpdate true - * description: The horizontal alignment of the icon and text. */ + @BeanProperty(visualUpdate = true, enumerationValues = { + "SwingConstants.LEFT", + "SwingConstants.CENTER", + "SwingConstants.RIGHT", + "SwingConstants.LEADING", + "SwingConstants.TRAILING"}, description + = "The horizontal alignment of the icon and text.") public void setHorizontalAlignment(int alignment) { if (alignment == horizontalAlignment) return; int oldValue = horizontalAlignment; @@ -860,14 +830,12 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl *
  • {@code SwingConstants.TOP} *
  • {@code SwingConstants.BOTTOM} * - * @beaninfo - * bound: true - * enum: TOP SwingConstants.TOP - * CENTER SwingConstants.CENTER - * BOTTOM SwingConstants.BOTTOM - * attribute: visualUpdate true - * description: The vertical position of the text relative to the icon. */ + @BeanProperty(visualUpdate = true, enumerationValues = { + "SwingConstants.TOP", + "SwingConstants.CENTER", + "SwingConstants.BOTTOM"}, description + = "The vertical position of the text relative to the icon.") public void setVerticalTextPosition(int textPosition) { if (textPosition == verticalTextPosition) return; int oldValue = verticalTextPosition; @@ -905,16 +873,14 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * * @exception IllegalArgumentException if textPosition * is not one of the legal values listed above - * @beaninfo - * bound: true - * enum: LEFT SwingConstants.LEFT - * CENTER SwingConstants.CENTER - * RIGHT SwingConstants.RIGHT - * LEADING SwingConstants.LEADING - * TRAILING SwingConstants.TRAILING - * attribute: visualUpdate true - * description: The horizontal position of the text relative to the icon. */ + @BeanProperty(visualUpdate = true, enumerationValues = { + "SwingConstants.LEFT", + "SwingConstants.CENTER", + "SwingConstants.RIGHT", + "SwingConstants.LEADING", + "SwingConstants.TRAILING"}, description + = "The horizontal position of the text relative to the icon.") public void setHorizontalTextPosition(int textPosition) { if (textPosition == horizontalTextPosition) return; int oldValue = horizontalTextPosition; @@ -951,12 +917,9 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * @param iconTextGap the space between icon and text if these properties are set. * @since 1.4 * @see #getIconTextGap - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: If both the icon and text properties are set, this - * property defines the space between them. */ + @BeanProperty(visualUpdate = true, description + = "If both the icon and text properties are set, this property defines the space between them.") public void setIconTextGap(int iconTextGap) { int oldValue = this.iconTextGap; this.iconTextGap = iconTextGap; @@ -1095,11 +1058,9 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * @see #configurePropertiesFromAction * @see #createActionPropertyChangeListener * @see #actionPropertyChanged - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: the Action instance connected with this ActionEvent source */ + @BeanProperty(visualUpdate = true, description + = "the Action instance connected with this ActionEvent source") public void setAction(Action a) { Action oldValue = getAction(); if (action==null || !action.equals(a)) { @@ -1393,11 +1354,9 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * @param b if true and border property is not null, * the border is painted * @see #isBorderPainted - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: Whether the border should be painted. */ + @BeanProperty(visualUpdate = true, description + = "Whether the border should be painted.") public void setBorderPainted(boolean b) { boolean oldValue = paintBorder; paintBorder = b; @@ -1443,11 +1402,9 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * * @param b if true, the focus state should be painted * @see #isFocusPainted - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: Whether focus should be painted */ + @BeanProperty(visualUpdate = true, description + = "Whether focus should be painted") public void setFocusPainted(boolean b) { boolean oldValue = paintFocus; paintFocus = b; @@ -1486,12 +1443,9 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * the content area is not filled * @see #isContentAreaFilled * @see #setOpaque - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: Whether the button should paint the content area - * or leave it transparent. */ + @BeanProperty(visualUpdate = true, description + = "Whether the button should paint the content area or leave it transparent.") public void setContentAreaFilled(boolean b) { boolean oldValue = contentAreaFilled; contentAreaFilled = b; @@ -1522,11 +1476,9 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * * @param b if true, rollover effects should be painted * @see #isRolloverEnabled - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: Whether rollover effects should be enabled. */ + @BeanProperty(visualUpdate = true, description + = "Whether rollover effects should be enabled.") public void setRolloverEnabled(boolean b) { boolean oldValue = rolloverEnabled; rolloverEnabled = b; @@ -1569,12 +1521,9 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * @param mnemonic the key code which represents the mnemonic * @see java.awt.event.KeyEvent * @see #setDisplayedMnemonicIndex - * - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: the keyboard character mnemonic */ + @BeanProperty(visualUpdate = true, description + = "the keyboard character mnemonic") public void setMnemonic(int mnemonic) { int oldValue = getMnemonic(); model.setMnemonic(mnemonic); @@ -1589,11 +1538,9 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * * @param mnemonic a char specifying the mnemonic value * @see #setMnemonic(int) - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: the keyboard character mnemonic */ + @BeanProperty(visualUpdate = true, description + = "the keyboard character mnemonic") public void setMnemonic(char mnemonic) { int vk = (int) mnemonic; if(vk >= 'a' && vk <='z') @@ -1622,13 +1569,9 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * @exception IllegalArgumentException will be thrown if index * is >= length of the text, or < -1 * @see #getDisplayedMnemonicIndex - * - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: the index into the String to draw the keyboard character - * mnemonic at */ + @BeanProperty(visualUpdate = true, description + = "the index into the String to draw the keyboard character mnemonic at") public void setDisplayedMnemonicIndex(int index) throws IllegalArgumentException { int oldValue = mnemonicIndex; @@ -1743,10 +1686,9 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * Sets the model that this button represents. * @param newModel the new ButtonModel * @see #getModel - * @beaninfo - * bound: true - * description: Model that the Button uses. */ + @BeanProperty(description + = "Model that the Button uses.") public void setModel(ButtonModel newModel) { ButtonModel oldModel = getModel(); @@ -1804,12 +1746,9 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * Sets the L&F object that renders this component. * @param ui the ButtonUI L&F object * @see #getUI - * @beaninfo - * bound: true - * hidden: true - * attribute: visualUpdate true - * description: The UI object that implements the LookAndFeel. */ + @BeanProperty(hidden = true, visualUpdate = true, description + = "The UI object that implements the LookAndFeel.") public void setUI(ButtonUI ui) { super.setUI(ui); // disabled icons are generated by the LF so they should be unset here @@ -1897,6 +1836,7 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * array if no listeners have been added * @since 1.4 */ + @BeanProperty(bound = false) public ChangeListener[] getChangeListeners() { return listenerList.getListeners(ChangeListener.class); } @@ -1954,6 +1894,7 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * array if no listeners have been added * @since 1.4 */ + @BeanProperty(bound = false) public ActionListener[] getActionListeners() { return listenerList.getListeners(ActionListener.class); } @@ -2122,11 +2063,10 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * * @param label a String containing the text * @deprecated - Replaced by setText(text) - * @beaninfo - * bound: true - * description: Replace by setText(text) */ @Deprecated + @BeanProperty(description + = "Replace by setText(text)") public void setLabel(String label) { setText(label); } @@ -2155,6 +2095,7 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * array if no listeners have been added * @since 1.4 */ + @BeanProperty(bound = false) public ItemListener[] getItemListeners() { return listenerList.getListeners(ItemListener.class); } @@ -2166,7 +2107,8 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl * @return an array containing 1 Object: the text of the button, * if the item is selected; otherwise null */ - public Object[] getSelectedObjects() { + @BeanProperty(bound = false) + public Object[] getSelectedObjects() { if (isSelected() == false) { return null; } diff --git a/jdk/src/java.desktop/share/classes/javax/swing/Box.java b/jdk/src/java.desktop/share/classes/javax/swing/Box.java index 73588b3cda6..84d98ae7fed 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/Box.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/Box.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,15 +22,12 @@ * 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.beans.ConstructorProperties; -import java.util.Locale; -import java.io.Serializable; import javax.accessibility.*; /** @@ -77,6 +74,7 @@ import javax.accessibility.*; * @author Timothy Prinzing * @since 1.2 */ +@JavaBean(defaultProperty = "accessibleContext") @SuppressWarnings("serial") public class Box extends JComponent implements Accessible { @@ -413,6 +411,7 @@ public class Box extends JComponent implements Accessible { * @return an AccessibleBox that serves as the * AccessibleContext of this Box */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleBox(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/ImageIcon.java b/jdk/src/java.desktop/share/classes/javax/swing/ImageIcon.java index 8c913e17332..8a63fe74cab 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/ImageIcon.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/ImageIcon.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,7 @@ package javax.swing; import java.awt.*; import java.awt.image.*; import java.beans.ConstructorProperties; +import java.beans.BeanProperty; import java.beans.Transient; import java.net.URL; @@ -567,11 +568,10 @@ public class ImageIcon implements Icon, Serializable, Accessible { * * @return an AccessibleImageIcon that serves as the * AccessibleContext of this ImageIcon - * @beaninfo - * expert: true - * description: The AccessibleContext associated with this ImageIcon. * @since 1.3 */ + @BeanProperty(expert = true, description + = "The AccessibleContext associated with this ImageIcon.") public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleImageIcon(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JApplet.java b/jdk/src/java.desktop/share/classes/javax/swing/JApplet.java index 6a00de486d2..2d9ce397bc5 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JApplet.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JApplet.java @@ -33,6 +33,8 @@ import java.awt.Container; import java.awt.Graphics; import java.awt.HeadlessException; import java.awt.LayoutManager; +import java.beans.BeanProperty; +import java.beans.JavaBean; import javax.accessibility.Accessible; import javax.accessibility.AccessibleContext; @@ -87,14 +89,12 @@ import javax.accessibility.AccessibleContext; * Please see {@link java.beans.XMLEncoder}. * * @see javax.swing.RootPaneContainer - * @beaninfo - * attribute: isContainer true - * attribute: containerDelegate getContentPane - * description: Swing's Applet subclass. * * @author Arnaud Weber * @since 1.2 */ +@JavaBean(defaultProperty = "JMenuBar", description = "Swing's Applet subclass.") +@SwingContainer(delegate = "getContentPane") @SuppressWarnings("serial") // Same-version serialization only public class JApplet extends Applet implements Accessible, RootPaneContainer, @@ -203,12 +203,9 @@ public class JApplet extends Applet implements Accessible, * @see #getTransferHandler * @see java.awt.Component#setDropTarget * @since 1.6 - * - * @beaninfo - * bound: true - * hidden: true - * description: Mechanism for transfer of data into the component */ + @BeanProperty(hidden = true, description + = "Mechanism for transfer of data into the component") public void setTransferHandler(TransferHandler newHandler) { TransferHandler oldHandler = transferHandler; transferHandler = newHandler; @@ -242,11 +239,9 @@ public class JApplet extends Applet implements Accessible, * @param menuBar the menubar being placed in the applet * * @see #getJMenuBar - * - * @beaninfo - * hidden: true - * description: The menubar for accessing pulldown menus from this applet. */ + @BeanProperty(bound = false, hidden = true, description + = "The menubar for accessing pulldown menus from this applet.") public void setJMenuBar(final JMenuBar menuBar) { getRootPane().setJMenuBar(menuBar); } @@ -291,10 +286,9 @@ public class JApplet extends Applet implements Accessible, * @see #setLayout * @see #isRootPaneCheckingEnabled * @see javax.swing.RootPaneContainer - * @beaninfo - * hidden: true - * description: Whether the add and setLayout methods are forwarded */ + @BeanProperty(hidden = true, description + = "Whether the add and setLayout methods are forwarded") protected void setRootPaneCheckingEnabled(boolean enabled) { rootPaneCheckingEnabled = enabled; } @@ -377,6 +371,8 @@ public class JApplet extends Applet implements Accessible, * @see #setRootPane * @see RootPaneContainer#getRootPane */ + @BeanProperty(bound = false, hidden = true, description + = "the RootPane object for this applet.") public JRootPane getRootPane() { return rootPane; } @@ -387,10 +383,6 @@ public class JApplet extends Applet implements Accessible, * @param root the rootPane object for this applet * * @see #getRootPane - * - * @beaninfo - * hidden: true - * description: the RootPane object for this applet. */ protected void setRootPane(JRootPane root) { if(rootPane != null) { @@ -428,12 +420,9 @@ public class JApplet extends Applet implements Accessible, * exception) if the content pane parameter is null * @see #getContentPane * @see RootPaneContainer#setContentPane - * - * @beaninfo - * hidden: true - * description: The client area of the applet where child - * components are normally inserted. */ + @BeanProperty(bound = false, hidden = true, description + = "The client area of the applet where child components are normally inserted.") public void setContentPane(Container contentPane) { getRootPane().setContentPane(contentPane); } @@ -456,11 +445,9 @@ public class JApplet extends Applet implements Accessible, * * @see #getLayeredPane * @see RootPaneContainer#setLayeredPane - * - * @beaninfo - * hidden: true - * description: The pane which holds the various applet layers. */ + @BeanProperty(bound = false, hidden = true, description + = "The pane which holds the various applet layers.") public void setLayeredPane(JLayeredPane layeredPane) { getRootPane().setLayeredPane(layeredPane); } @@ -482,11 +469,9 @@ public class JApplet extends Applet implements Accessible, * * @see #getGlassPane * @see RootPaneContainer#setGlassPane - * - * @beaninfo - * hidden: true - * description: A transparent pane used for menu rendering. */ + @BeanProperty(bound = false, hidden = true, description + = "A transparent pane used for menu rendering.") public void setGlassPane(Component glassPane) { getRootPane().setGlassPane(glassPane); } @@ -496,6 +481,7 @@ public class JApplet extends Applet implements Accessible, * * @since 1.6 */ + @BeanProperty(bound = false) public Graphics getGraphics() { JComponent.getGraphicsInvoked(this); return super.getGraphics(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JButton.java b/jdk/src/java.desktop/share/classes/javax/swing/JButton.java index 937de3adad6..dc2dcbcea32 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JButton.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JButton.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,21 +24,16 @@ */ package javax.swing; +import java.beans.JavaBean; +import java.beans.BeanProperty; import java.beans.ConstructorProperties; -import java.awt.*; -import java.awt.event.*; -import java.awt.image.*; - import javax.swing.plaf.*; -import javax.swing.event.*; import javax.accessibility.*; import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; import java.io.IOException; - /** * An implementation of a "push" button. *

    @@ -69,13 +64,11 @@ import java.io.IOException; * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. * - * @beaninfo - * attribute: isContainer false - * description: An implementation of a \"push\" button. - * * @author Jeff Dinkins * @since 1.2 */ +@JavaBean(defaultProperty = "UIClassID", description = "An implementation of a \"push\" button.") +@SwingContainer(false) @SuppressWarnings("serial") public class JButton extends AbstractButton implements Accessible { @@ -156,10 +149,9 @@ public class JButton extends AbstractButton implements Accessible { * @return the string "ButtonUI" * @see JComponent#getUIClassID * @see UIDefaults#getUI - * @beaninfo - * expert: true - * description: A string that specifies the name of the L&F class. */ + @BeanProperty(bound = false, expert = true, description + = "A string that specifies the name of the L&F class.") public String getUIClassID() { return uiClassID; } @@ -176,9 +168,9 @@ public class JButton extends AbstractButton implements Accessible { * @return the value of the defaultButton property * @see JRootPane#setDefaultButton * @see #isDefaultCapable - * @beaninfo - * description: Whether or not this button is the default button */ + @BeanProperty(bound = false, description + = "Whether or not this button is the default button") public boolean isDefaultButton() { JRootPane root = SwingUtilities.getRootPane(this); if (root != null) { @@ -211,11 +203,9 @@ public class JButton extends AbstractButton implements Accessible { * capable of being the default button on the * RootPane; otherwise false * @see #isDefaultCapable - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: Whether or not this button can be the default button */ + @BeanProperty(visualUpdate = true, description + = "Whether or not this button can be the default button") public void setDefaultCapable(boolean defaultCapable) { boolean oldDefaultCapable = this.defaultCapable; this.defaultCapable = defaultCapable; @@ -283,10 +273,9 @@ public class JButton extends AbstractButton implements Accessible { * * @return an AccessibleJButton that serves as the * AccessibleContext of this JButton - * @beaninfo - * expert: true - * description: The AccessibleContext associated with this Button. */ + @BeanProperty(bound = false, expert = true, description + = "The AccessibleContext associated with this Button.") public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJButton(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JCheckBox.java b/jdk/src/java.desktop/share/classes/javax/swing/JCheckBox.java index 400b8efae78..c793112f98f 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JCheckBox.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JCheckBox.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,8 @@ */ package javax.swing; -import java.awt.*; -import java.awt.event.*; -import java.beans.*; +import java.beans.JavaBean; +import java.beans.BeanProperty; import javax.swing.plaf.*; import javax.accessibility.*; @@ -35,7 +34,6 @@ import java.io.ObjectOutputStream; import java.io.ObjectInputStream; import java.io.IOException; - /** * An implementation of a check box -- an item that can be selected or * deselected, and which displays its state to the user. @@ -69,13 +67,11 @@ import java.io.IOException; * * @see JRadioButton * - * @beaninfo - * attribute: isContainer false - * description: A component which can be selected or deselected. - * * @author Jeff Dinkins * @since 1.2 */ +@JavaBean(description = "A component which can be selected or deselected.") +@SwingContainer(false) @SuppressWarnings("serial") // Same-version serialization only public class JCheckBox extends JToggleButton implements Accessible { @@ -195,12 +191,10 @@ public class JCheckBox extends JToggleButton implements Accessible { * @param b true requests that the border be painted flat; * false requests normal borders * @see #isBorderPaintedFlat - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: Whether the border is painted flat. * @since 1.3 */ + @BeanProperty(visualUpdate = true, description + = "Whether the border is painted flat.") public void setBorderPaintedFlat(boolean b) { boolean oldValue = flat; flat = b; @@ -239,10 +233,9 @@ public class JCheckBox extends JToggleButton implements Accessible { * @return the string "CheckBoxUI" * @see JComponent#getUIClassID * @see UIDefaults#getUI - * @beaninfo - * expert: true - * description: A string that specifies the name of the L&F class */ + @BeanProperty(bound = false, expert = true, description + = "A string that specifies the name of the L&F class") public String getUIClassID() { return uiClassID; } @@ -311,10 +304,9 @@ public class JCheckBox extends JToggleButton implements Accessible { * * @return an AccessibleJCheckBox that serves as the * AccessibleContext of this JCheckBox - * @beaninfo - * expert: true - * description: The AccessibleContext associated with this CheckBox. */ + @BeanProperty(bound = false, expert = true, description + = "The AccessibleContext associated with this CheckBox.") public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJCheckBox(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JCheckBoxMenuItem.java b/jdk/src/java.desktop/share/classes/javax/swing/JCheckBoxMenuItem.java index 4aaa4417caa..f37a6db0083 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JCheckBoxMenuItem.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JCheckBoxMenuItem.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,20 +24,14 @@ */ package javax.swing; -import java.util.EventListener; - -import java.awt.*; -import java.awt.event.*; -import java.awt.image.*; +import java.beans.JavaBean; +import java.beans.BeanProperty; import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; import java.io.IOException; -import javax.swing.plaf.*; import javax.accessibility.*; - /** * A menu item that can be selected or deselected. If selected, the menu * item typically appears with a checkmark next to it. If unselected or @@ -81,14 +75,12 @@ import javax.accessibility.*; * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. * - * @beaninfo - * attribute: isContainer false - * description: A menu item which can be selected or deselected. - * * @author Georges Saab * @author David Karlton * @since 1.2 */ +@JavaBean(description = "A menu item which can be selected or deselected.") +@SwingContainer(false) @SuppressWarnings("serial") // Same-version serialization only public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants, Accessible @@ -178,6 +170,7 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants, * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; } @@ -200,10 +193,9 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants, * * @param b a boolean value indicating the item's * selected-state, where true=selected - * @beaninfo - * description: The selection state of the check box menu item - * hidden: true */ + @BeanProperty(bound = false, hidden = true, description + = "The selection state of the check box menu item") public synchronized void setState(boolean b) { setSelected(b); } @@ -216,6 +208,7 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants, * @return an array containing one Object -- the text of the menu item * -- if the item is selected; otherwise null */ + @BeanProperty(bound = false) public Object[] getSelectedObjects() { if (isSelected() == false) return null; @@ -274,6 +267,7 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants, * @return an AccessibleJCheckBoxMenuItem that serves as the * AccessibleContext of this AccessibleJCheckBoxMenuItem */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJCheckBoxMenuItem(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JColorChooser.java b/jdk/src/java.desktop/share/classes/javax/swing/JColorChooser.java index d7300157e02..1e524c4dd66 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JColorChooser.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JColorChooser.java @@ -22,11 +22,12 @@ * 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.*; @@ -36,7 +37,6 @@ import javax.accessibility.*; import sun.swing.SwingUtilities2; - /** * JColorChooser provides a pane of controls designed to allow * a user to manipulate and select a color. @@ -73,17 +73,13 @@ import sun.swing.SwingUtilities2; * has been added to the java.beans 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 */ +@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 { @@ -261,12 +257,9 @@ public class JColorChooser extends JComponent implements Accessible { * * @param ui the ColorChooserUI L&F object * @see UIDefaults#getUI - * - * @beaninfo - * bound: true - * hidden: true - * description: The UI object that implements the color chooser's LookAndFeel. */ + @BeanProperty(hidden = true, description + = "The UI object that implements the color chooser's LookAndFeel.") public void setUI(ColorChooserUI ui) { super.setUI(ui); } @@ -289,6 +282,7 @@ public class JColorChooser extends JComponent implements Accessible { * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; } @@ -308,12 +302,9 @@ public class JColorChooser extends JComponent implements Accessible { * The ColorSelectionModel will fire a ChangeEvent * @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. */ + @BeanProperty(bound = false, description + = "The current color the chooser is to display.") public void setColor(Color color) { selectionModel.setSelectedColor(color); @@ -381,11 +372,9 @@ public class JColorChooser extends JComponent implements Accessible { * @see #getDragEnabled * @see #setTransferHandler * @see TransferHandler - * - * @beaninfo - * description: Determines whether automatic drag handling is enabled. - * bound: false */ + @BeanProperty(bound = false, description + = "Determines whether automatic drag handling is enabled.") public void setDragEnabled(boolean b) { if (b && GraphicsEnvironment.isHeadless()) { throw new HeadlessException(); @@ -411,12 +400,9 @@ public class JColorChooser extends JComponent implements Accessible { * * @param preview the JComponent which displays the current color * @see JComponent#addPropertyChangeListener - * - * @beaninfo - * bound: true - * hidden: true - * description: The UI component which displays the current color. */ + @BeanProperty(hidden = true, description + = "The UI component which displays the current color.") public void setPreviewPanel(JComponent preview) { if (previewPanel != preview) { @@ -496,12 +482,9 @@ public class JColorChooser extends JComponent implements Accessible { * * @param panels an array of AbstractColorChooserPanel * objects - * - * @beaninfo - * bound: true - * hidden: true - * description: An array of different chooser types. */ + @BeanProperty(hidden = true, description + = "An array of different chooser types.") public void setChooserPanels( AbstractColorChooserPanel[] panels) { AbstractColorChooserPanel[] oldValue = chooserPanels; chooserPanels = panels; @@ -531,12 +514,9 @@ public class JColorChooser extends JComponent implements Accessible { * Sets the model containing the selected color. * * @param newModel the new ColorSelectionModel object - * - * @beaninfo - * bound: true - * hidden: true - * description: The model which contains the currently selected color. */ + @BeanProperty(hidden = true, description + = "The model which contains the currently selected color.") public void setSelectionModel(ColorSelectionModel newModel ) { ColorSelectionModel oldModel = selectionModel; selectionModel = newModel; @@ -603,6 +583,7 @@ public class JColorChooser extends JComponent implements Accessible { * @return an AccessibleJColorChooser that serves as the * AccessibleContext of this JColorChooser */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJColorChooser(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JComboBox.java b/jdk/src/java.desktop/share/classes/javax/swing/JComboBox.java index b8aff5ab832..17d9e64d91f 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JComboBox.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JComboBox.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,8 @@ */ package javax.swing; +import java.beans.JavaBean; +import java.beans.BeanProperty; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.beans.Transient; @@ -71,14 +73,12 @@ import javax.accessibility.*; * * @param the type of the elements of this combo box * - * @beaninfo - * attribute: isContainer false - * description: A combination of a text field and a drop-down list. - * * @author Arnaud Weber * @author Mark Davidson * @since 1.2 */ +@JavaBean(defaultProperty = "UI", description = "A combination of a text field and a drop-down list.") +@SwingContainer(false) @SuppressWarnings("serial") // Same-version serialization only public class JComboBox extends JComponent implements ItemSelectable,ListDataListener,ActionListener, Accessible { @@ -255,13 +255,9 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { * * @param ui the ComboBoxUI L&F object * @see UIDefaults#getUI - * - * @beaninfo - * bound: true - * hidden: true - * attribute: visualUpdate true - * description: The UI object that implements the Component's LookAndFeel. */ + @BeanProperty(hidden = true, visualUpdate = true, description + = "The UI object that implements the Component's LookAndFeel.") public void setUI(ComboBoxUI ui) { super.setUI(ui); } @@ -288,6 +284,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; } @@ -308,11 +305,9 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { * * @param aModel the ComboBoxModel that provides the * displayed list of items - * - * @beaninfo - * bound: true - * description: Model that the combo box uses to get data to display. */ + @BeanProperty(description + = "Model that the combo box uses to get data to display.") public void setModel(ComboBoxModel aModel) { ComboBoxModel oldModel = dataModel; if (oldModel != null) { @@ -363,12 +358,9 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { * This method fires a property changed event. * * @param aFlag if true, lightweight popups are desired - * - * @beaninfo - * bound: true - * expert: true - * description: Set to false to require heavyweight popups. */ + @BeanProperty(expert = true, description + = "Set to false to require heavyweight popups.") public void setLightWeightPopupEnabled(boolean aFlag) { boolean oldFlag = lightWeightPopupEnabled; lightWeightPopupEnabled = aFlag; @@ -398,12 +390,9 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { * * @param aFlag a boolean value, where true indicates that the * field is editable - * - * @beaninfo - * bound: true - * preferred: true - * description: If true, the user can type a new value in the combo box. */ + @BeanProperty(preferred = true, description + = "If true, the user can type a new value in the combo box.") public void setEditable(boolean aFlag) { boolean oldFlag = isEditable; isEditable = aFlag; @@ -427,11 +416,9 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { * * @param count an integer specifying the maximum number of items to * display in the list before using a scrollbar - * @beaninfo - * bound: true - * preferred: true - * description: The maximum number of rows the popup should have */ + @BeanProperty(preferred = true, description + = "The maximum number of rows the popup should have") public void setMaximumRowCount(int count) { int oldCount = maximumRowCount; maximumRowCount = count; @@ -465,11 +452,9 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { * @param aRenderer the ListCellRenderer that * displays the selected item * @see #setEditor - * @beaninfo - * bound: true - * expert: true - * description: The renderer that paints the item selected in the list. */ + @BeanProperty(expert = true, description + = "The renderer that paints the item selected in the list.") public void setRenderer(ListCellRenderer aRenderer) { ListCellRenderer oldRenderer = renderer; renderer = aRenderer; @@ -497,11 +482,9 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { * @param anEditor the ComboBoxEditor that * displays the selected item * @see #setRenderer - * @beaninfo - * bound: true - * expert: true - * description: The editor that combo box uses to edit the current value */ + @BeanProperty(expert = true, description + = "The editor that combo box uses to edit the current value") public void setEditor(ComboBoxEditor anEditor) { ComboBoxEditor oldEditor = editor; @@ -553,10 +536,9 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { * * @param anObject the list object to select; use null to clear the selection - * @beaninfo - * preferred: true - * description: Sets the selected item in the JComboBox. */ + @BeanProperty(bound = false, preferred = true, description + = "Sets the selected item in the JComboBox.") public void setSelectedItem(Object anObject) { Object oldSelection = selectedItemReminder; Object objectToSelect = anObject; @@ -618,10 +600,9 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { * where 0 specifies the first item in the list and -1 indicates no selection * @exception IllegalArgumentException if anIndex < -1 or * anIndex is greater than or equal to size - * @beaninfo - * preferred: true - * description: The item at index is selected. */ + @BeanProperty(bound = false, preferred = true, description + = "The item at index is selected.") public void setSelectedIndex(int anIndex) { int size = dataModel.getSize(); @@ -689,11 +670,9 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { * @param prototypeDisplayValue the prototype display value * @see #getPrototypeDisplayValue * @since 1.4 - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: The display prototype value, used to compute display width and height. */ + @BeanProperty(visualUpdate = true, description + = "The display prototype value, used to compute display width and height.") public void setPrototypeDisplayValue(E prototypeDisplayValue) { Object oldValue = this.prototypeDisplayValue; this.prototypeDisplayValue = prototypeDisplayValue; @@ -869,6 +848,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { * array if no listeners have been added * @since 1.4 */ + @BeanProperty(bound = false) public ItemListener[] getItemListeners() { return listenerList.getListeners(ItemListener.class); } @@ -907,6 +887,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { * array if no listeners have been added * @since 1.4 */ + @BeanProperty(bound = false) public ActionListener[] getActionListeners() { return listenerList.getListeners(ActionListener.class); } @@ -946,6 +927,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { * array if no listeners have been added * @since 1.4 */ + @BeanProperty(bound = false) public PopupMenuListener[] getPopupMenuListeners() { return listenerList.getListeners(PopupMenuListener.class); } @@ -1074,11 +1056,9 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { * @see #configurePropertiesFromAction * @see #createActionPropertyChangeListener * @see #actionPropertyChanged - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: the Action instance connected with this ActionEvent source */ + @BeanProperty(visualUpdate = true, description + = "the Action instance connected with this ActionEvent source") public void setAction(Action a) { Action oldValue = getAction(); if (action==null || !action.equals(a)) { @@ -1305,6 +1285,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { * @return an array of Objects containing one * element -- the selected item */ + @BeanProperty(bound = false) public Object[] getSelectedObjects() { Object selectedObject = getSelectedItem(); if ( selectedObject == null ) @@ -1394,11 +1375,9 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { * * @param b a boolean value, where true enables the component and * false disables it - * @beaninfo - * bound: true - * preferred: true - * description: Whether the combo box is enabled. */ + @BeanProperty(preferred = true, description + = "The enabled state of the component.") public void setEnabled(boolean b) { super.setEnabled(b); firePropertyChange( "enabled", !isEnabled(), isEnabled() ); @@ -1458,10 +1437,9 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { * character becomes the selected item. * * @param aManager a key selection manager - * @beaninfo - * expert: true - * description: The objects that changes the selection when a key is pressed. */ + @BeanProperty(bound = false, expert = true, description + = "The objects that changes the selection when a key is pressed.") public void setKeySelectionManager(KeySelectionManager aManager) { keySelectionManager = aManager; } @@ -1481,6 +1459,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { * * @return an integer equal to the number of items in the list */ + @BeanProperty(bound = false) public int getItemCount() { return dataModel.getSize(); } @@ -1629,6 +1608,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { * @return an AccessibleJComboBox that serves as the * AccessibleContext of this JComboBox */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if ( accessibleContext == null ) { accessibleContext = new AccessibleJComboBox(); @@ -2131,11 +2111,9 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { * * @see #getAccessibleName * @see #addPropertyChangeListener - * - * @beaninfo - * preferred: true - * description: Sets the accessible name for the component. */ + @BeanProperty(preferred = true, description + = "Sets the accessible name for the component.") public void setAccessibleName(String s) { ac.setAccessibleName(s); } @@ -2165,11 +2143,9 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible { * * @see #setAccessibleName * @see #addPropertyChangeListener - * - * @beaninfo - * preferred: true - * description: Sets the accessible description for the component. */ + @BeanProperty(preferred = true, description + = "Sets the accessible description for the component.") public void setAccessibleDescription(String s) { ac.setAccessibleDescription(s); } diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java b/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java index 7c85698cc9f..3276d534a48 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java @@ -25,6 +25,7 @@ package javax.swing; +import java.beans.*; import java.util.HashSet; import java.util.Hashtable; import java.util.Enumeration; @@ -36,10 +37,6 @@ import java.util.Set; import java.awt.*; import java.awt.event.*; import java.awt.peer.LightweightPeer; -import java.beans.PropertyChangeListener; -import java.beans.VetoableChangeListener; -import java.beans.VetoableChangeSupport; -import java.beans.Transient; import java.applet.Applet; @@ -176,6 +173,7 @@ import sun.swing.UIClientPropertyKey; * @author Arnaud Weber * @since 1.2 */ +@JavaBean(defaultProperty = "UIClassID") @SuppressWarnings("serial") // Same-version serialization only public abstract class JComponent extends Container implements Serializable, TransferHandler.HasGetTransferHandler @@ -479,11 +477,10 @@ public abstract class JComponent extends Container implements Serializable, * * @param value whether or not the JPopupMenu is inherited * @see #setComponentPopupMenu - * @beaninfo - * bound: true - * description: Whether or not the JPopupMenu is inherited * @since 1.5 */ + @BeanProperty(description + = "Whether or not the JPopupMenu is inherited") public void setInheritsPopupMenu(boolean value) { boolean oldValue = getFlag(INHERITS_POPUP_MENU); setFlag(INHERITS_POPUP_MENU, value); @@ -519,12 +516,10 @@ public abstract class JComponent extends Container implements Serializable, * @param popup - the popup that will be assigned to this component * may be null * @see #getComponentPopupMenu - * @beaninfo - * bound: true - * preferred: true - * description: Popup to show * @since 1.5 */ + @BeanProperty(preferred = true, description + = "Popup to show") public void setComponentPopupMenu(JPopupMenu popup) { if(popup != null) { enableEvents(AWTEvent.MOUSE_EVENT_MASK); @@ -649,12 +644,9 @@ public abstract class JComponent extends Container implements Serializable, * @see #updateUI * @see UIManager#getLookAndFeel * @see UIManager#getUI - * @beaninfo - * bound: true - * hidden: true - * attribute: visualUpdate true - * description: The component's look and feel delegate. */ + @BeanProperty(hidden = true, visualUpdate = true, description + = "The component's look and feel delegate.") protected void setUI(ComponentUI newUI) { /* We do not check that the UI instance is different * before allowing the switch in order to enable the @@ -718,10 +710,9 @@ public abstract class JComponent extends Container implements Serializable, * @return the UIDefaults key for a * ComponentUI subclass * @see UIDefaults#getUI - * @beaninfo - * expert: true - * description: UIClassID */ + @BeanProperty(bound = false, expert = true, description + = "UIClassID") public String getUIClassID() { return uiClassID; } @@ -1265,6 +1256,7 @@ public abstract class JComponent extends Container implements Serializable, * @return true if the component is currently painting a tile, * false otherwise */ + @BeanProperty(bound = false) public boolean isPaintingTile() { return getFlag(IS_PAINTING_TILE); } @@ -1295,6 +1287,7 @@ public abstract class JComponent extends Container implements Serializable, * @see #print * @since 1.6 */ + @BeanProperty(bound = false) public final boolean isPaintingForPrint() { return getFlag(IS_PRINTING); } @@ -1319,6 +1312,7 @@ public abstract class JComponent extends Container implements Serializable, * Container.setFocusCycleRoot(boolean). */ @Deprecated + @BeanProperty(bound = false) public boolean isManagingFocus() { return false; } @@ -1589,11 +1583,9 @@ public abstract class JComponent extends Container implements Serializable, * @see #getVerifyInputWhenFocusTarget * * @since 1.3 - * @beaninfo - * bound: true - * description: Whether the Component verifies input before accepting - * focus. */ + @BeanProperty(description + = "Whether the Component verifies input before accepting focus.") public void setVerifyInputWhenFocusTarget(boolean verifyInputWhenFocusTarget) { boolean oldVerifyInputWhenFocusTarget = @@ -1641,11 +1633,9 @@ public abstract class JComponent extends Container implements Serializable, * Sets the preferred size of this component. * If preferredSize is null, the UI will * be asked for the preferred size. - * @beaninfo - * preferred: true - * bound: true - * description: The preferred size of the component. */ + @BeanProperty(preferred = true, description + = "The preferred size of the component.") public void setPreferredSize(Dimension preferredSize) { super.setPreferredSize(preferredSize); } @@ -1685,10 +1675,9 @@ public abstract class JComponent extends Container implements Serializable, * @param maximumSize a Dimension containing the * desired maximum allowable size * @see #getMaximumSize - * @beaninfo - * bound: true - * description: The maximum size of the component. */ + @BeanProperty(description + = "The maximum size of the component.") public void setMaximumSize(Dimension maximumSize) { super.setMaximumSize(maximumSize); } @@ -1726,10 +1715,9 @@ public abstract class JComponent extends Container implements Serializable, * * @param minimumSize the new minimum size of this component * @see #getMinimumSize - * @beaninfo - * bound: true - * description: The minimum size of the component. */ + @BeanProperty(description + = "The minimum size of the component.") public void setMinimumSize(Dimension minimumSize) { super.setMinimumSize(minimumSize); } @@ -1793,12 +1781,9 @@ public abstract class JComponent extends Container implements Serializable, * @param border the border to be rendered for this component * @see Border * @see CompoundBorder - * @beaninfo - * bound: true - * preferred: true - * attribute: visualUpdate true - * description: The component's border. */ + @BeanProperty(preferred = true, visualUpdate = true, description + = "The component's border.") public void setBorder(Border border) { Border oldBorder = this.border; @@ -1831,6 +1816,7 @@ public abstract class JComponent extends Container implements Serializable, * @return the value of the insets property * @see #setBorder */ + @BeanProperty(expert = true) public Insets getInsets() { if (border != null) { return border.getBorderInsets(this); @@ -1849,8 +1835,6 @@ public abstract class JComponent extends Container implements Serializable, * @param insets the Insets object, which can be reused * @return the Insets object * @see #getInsets - * @beaninfo - * expert: true */ public Insets getInsets(Insets insets) { if (insets == null) { @@ -1892,9 +1876,9 @@ public abstract class JComponent extends Container implements Serializable, * * @param alignmentY the new vertical alignment * @see #getAlignmentY - * @beaninfo - * description: The preferred vertical alignment of the component. */ + @BeanProperty(description + = "The preferred vertical alignment of the component.") public void setAlignmentY(float alignmentY) { this.alignmentY = validateAlignment(alignmentY); isAlignmentYSet = true; @@ -1921,9 +1905,9 @@ public abstract class JComponent extends Container implements Serializable, * * @param alignmentX the new horizontal alignment * @see #getAlignmentX - * @beaninfo - * description: The preferred horizontal alignment of the component. */ + @BeanProperty(description + = "The preferred horizontal alignment of the component.") public void setAlignmentX(float alignmentX) { this.alignmentX = validateAlignment(alignmentX); isAlignmentXSet = true; @@ -1939,10 +1923,9 @@ public abstract class JComponent extends Container implements Serializable, * @param inputVerifier the new input verifier * @since 1.3 * @see InputVerifier - * @beaninfo - * bound: true - * description: The component's input verifier. */ + @BeanProperty(description + = "The component's input verifier.") public void setInputVerifier(InputVerifier inputVerifier) { InputVerifier oldInputVerifier = (InputVerifier)getClientProperty( JComponent_INPUT_VERIFIER); @@ -1967,6 +1950,7 @@ public abstract class JComponent extends Container implements Serializable, * then invoke operations on that object to draw on the component. * @return this components graphics context */ + @BeanProperty(bound = false) public Graphics getGraphics() { if (DEBUG_GRAPHICS_LOADED && shouldDebugGraphics() != 0) { DebugGraphics graphics = new DebugGraphics(super.getGraphics(), @@ -1993,15 +1977,13 @@ public abstract class JComponent extends Container implements Serializable, *

  • A value of 0 causes no changes to the debugging options. * * debugOptions is bitwise OR'd into the current value - * - * @beaninfo - * preferred: true - * enum: NONE_OPTION DebugGraphics.NONE_OPTION - * LOG_OPTION DebugGraphics.LOG_OPTION - * FLASH_OPTION DebugGraphics.FLASH_OPTION - * BUFFERED_OPTION DebugGraphics.BUFFERED_OPTION - * description: Diagnostic options for graphics operations. */ + @BeanProperty(bound = false, preferred = true, enumerationValues = { + "DebugGraphics.NONE_OPTION", + "DebugGraphics.LOG_OPTION", + "DebugGraphics.FLASH_OPTION", + "DebugGraphics.BUFFERED_OPTION"}, description + = "Diagnostic options for graphics operations.") public void setDebugGraphicsOptions(int debugOptions) { DebugGraphics.setDebugOptions(this, debugOptions); } @@ -2278,6 +2260,7 @@ public abstract class JComponent extends Container implements Serializable, * @return an array of KeyStroke objects * @see #registerKeyboardAction */ + @BeanProperty(bound = false) public KeyStroke[] getRegisteredKeyStrokes() { int[] counts = new int[3]; KeyStroke[][] strokes = new KeyStroke[3][]; @@ -2616,6 +2599,7 @@ public abstract class JComponent extends Container implements Serializable, * @see #getBaseline(int, int) * @since 1.6 */ + @BeanProperty(bound = false) public BaselineResizeBehavior getBaselineResizeBehavior() { if (ui != null) { return ui.getBaselineResizeBehavior(this); @@ -2666,10 +2650,8 @@ public abstract class JComponent extends Container implements Serializable, * * @param aFlag true to make the component visible; false to * make it invisible - * - * @beaninfo - * attribute: visualUpdate true */ + @BeanProperty(hidden = true, visualUpdate = true) public void setVisible(boolean aFlag) { if (aFlag != isVisible()) { super.setVisible(aFlag); @@ -2699,13 +2681,9 @@ public abstract class JComponent extends Container implements Serializable, * @param enabled true if this component should be enabled, false otherwise * @see java.awt.Component#isEnabled * @see java.awt.Component#isLightweight - * - * @beaninfo - * preferred: true - * bound: true - * attribute: visualUpdate true - * description: The enabled state of the component. */ + @BeanProperty(expert = true, preferred = true, visualUpdate = true, description + = "The enabled state of the component.") public void setEnabled(boolean enabled) { boolean oldEnabled = isEnabled(); super.setEnabled(enabled); @@ -2722,13 +2700,9 @@ public abstract class JComponent extends Container implements Serializable, * * @param fg the desired foreground Color * @see java.awt.Component#getForeground - * - * @beaninfo - * preferred: true - * bound: true - * attribute: visualUpdate true - * description: The foreground color of the component. */ + @BeanProperty(preferred = true, visualUpdate = true, description + = "The foreground color of the component.") public void setForeground(Color fg) { Color oldFg = getForeground(); super.setForeground(fg); @@ -2752,13 +2726,9 @@ public abstract class JComponent extends Container implements Serializable, * @param bg the desired background Color * @see java.awt.Component#getBackground * @see #setOpaque - * - * @beaninfo - * preferred: true - * bound: true - * attribute: visualUpdate true - * description: The background color of the component. */ + @BeanProperty(preferred = true, visualUpdate = true, description + = "The background color of the component.") public void setBackground(Color bg) { Color oldBg = getBackground(); super.setBackground(bg); @@ -2773,13 +2743,9 @@ public abstract class JComponent extends Container implements Serializable, * * @param font the desired Font for this component * @see java.awt.Component#getFont - * - * @beaninfo - * preferred: true - * bound: true - * attribute: visualUpdate true - * description: The font for the component. */ + @BeanProperty(preferred = true, visualUpdate = true, description + = "The font for the component.") public void setFont(Font font) { Font oldFont = getFont(); super.setFont(font); @@ -3028,10 +2994,9 @@ public abstract class JComponent extends Container implements Serializable, * @param text the string to display; if the text is null, * the tool tip is turned off for this component * @see #TOOL_TIP_TEXT_KEY - * @beaninfo - * preferred: true - * description: The text to display in a tool tip. */ + @BeanProperty(bound = false, preferred = true, description + = "The text to display in a tool tip.") public void setToolTipText(String text) { String oldText = getToolTipText(); putClientProperty(TOOL_TIP_TEXT_KEY, text); @@ -3190,11 +3155,9 @@ public abstract class JComponent extends Container implements Serializable, * @see #getAutoscrolls * @see JViewport * @see JScrollPane - * - * @beaninfo - * expert: true - * description: Determines if this component automatically scrolls its contents when dragged. */ + @BeanProperty(bound = false, expert = true, description + = "Determines if this component automatically scrolls its contents when dragged.") public void setAutoscrolls(boolean autoscrolls) { setFlag(AUTOSCROLLS_SET, true); if (this.autoscrolls != autoscrolls) { @@ -3254,11 +3217,9 @@ public abstract class JComponent extends Container implements Serializable, * @see TransferHandler * @see #getTransferHandler * @since 1.4 - * @beaninfo - * bound: true - * hidden: true - * description: Mechanism for transfer of data to and from the component */ + @BeanProperty(hidden = true, description + = "Mechanism for transfer of data to and from the component") public void setTransferHandler(TransferHandler newHandler) { TransferHandler oldHandler = (TransferHandler)getClientProperty( JComponent_TRANSFER_HANDLER); @@ -4208,8 +4169,6 @@ public abstract class JComponent extends Container implements Serializable, * or if any keystroke already maps to another focus traversal * operation for this Component * @since 1.5 - * @beaninfo - * bound: true */ public void setFocusTraversalKeys(int id, Set keystrokes) @@ -4336,6 +4295,7 @@ public abstract class JComponent extends Container implements Serializable, * * @return the current x coordinate of the component's origin */ + @BeanProperty(bound = false) public int getX() { return super.getX(); } @@ -4348,6 +4308,7 @@ public abstract class JComponent extends Container implements Serializable, * * @return the current y coordinate of the component's origin */ + @BeanProperty(bound = false) public int getY() { return super.getY(); } @@ -4360,6 +4321,7 @@ public abstract class JComponent extends Container implements Serializable, * * @return the current width of this component */ + @BeanProperty(bound = false) public int getWidth() { return super.getWidth(); } @@ -4372,6 +4334,7 @@ public abstract class JComponent extends Container implements Serializable, * * @return the current height of this component */ + @BeanProperty(bound = false) public int getHeight() { return super.getHeight(); } /** @@ -4405,11 +4368,9 @@ public abstract class JComponent extends Container implements Serializable, * * @param isOpaque true if this component should be opaque * @see #isOpaque - * @beaninfo - * bound: true - * expert: true - * description: The component's opacity */ + @BeanProperty(expert = true, description + = "The component's opacity") public void setOpaque(boolean isOpaque) { boolean oldValue = getFlag(IS_OPAQUE); setFlag(IS_OPAQUE, isOpaque); @@ -4520,6 +4481,7 @@ public abstract class JComponent extends Container implements Serializable, * * @return the visible rectangle */ + @BeanProperty(bound = false) public Rectangle getVisibleRect() { Rectangle visibleRect = new Rectangle(); @@ -4628,6 +4590,7 @@ public abstract class JComponent extends Container implements Serializable, * * @since 1.4 */ + @BeanProperty(bound = false) public synchronized VetoableChangeListener[] getVetoableChangeListeners() { if (vetoableChangeSupport == null) { return new VetoableChangeListener[0]; @@ -4645,6 +4608,7 @@ public abstract class JComponent extends Container implements Serializable, * @return the top-level Container that this component is in, * or null if not in any container */ + @BeanProperty(bound = false) public Container getTopLevelAncestor() { for(Container p = this; p != null; p = p.getParent()) { if(p instanceof Window || p instanceof Applet) { @@ -4711,6 +4675,7 @@ public abstract class JComponent extends Container implements Serializable, * * @since 1.4 */ + @BeanProperty(bound = false) public AncestorListener[] getAncestorListeners() { AncestorNotifier ancestorNotifier = getAncestorNotifier(); if (ancestorNotifier == null) { @@ -4943,6 +4908,7 @@ public abstract class JComponent extends Container implements Serializable, * * @return always returns true */ + @BeanProperty(bound = false) public boolean isOptimizedDrawingEnabled() { return true; } @@ -5392,6 +5358,7 @@ public abstract class JComponent extends Container implements Serializable, * @return the JRootPane that contains this component, * or null if no JRootPane is found */ + @BeanProperty(bound = false) public JRootPane getRootPane() { return SwingUtilities.getRootPane(this); } diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JDesktopPane.java b/jdk/src/java.desktop/share/classes/javax/swing/JDesktopPane.java index 047070460bc..99a2fe8ab6a 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JDesktopPane.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JDesktopPane.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ - package javax.swing; import java.util.List; @@ -34,16 +33,15 @@ import javax.accessibility.*; import java.awt.Component; import java.awt.Container; -import java.awt.DefaultFocusTraversalPolicy; -import java.awt.FocusTraversalPolicy; -import java.awt.Window; +import java.beans.JavaBean; +import java.beans.BeanProperty; import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; import java.io.IOException; import java.beans.PropertyVetoException; import java.util.Set; import java.util.TreeSet; import java.util.LinkedHashSet; + /** * A container used to create a multiple-document interface or a virtual desktop. * You create JInternalFrame objects and add them to the @@ -88,6 +86,7 @@ import java.util.LinkedHashSet; * @author David Kloba * @since 1.2 */ +@JavaBean(defaultProperty = "UI") @SuppressWarnings("serial") // Same-version serialization only public class JDesktopPane extends JLayeredPane implements Accessible { @@ -163,12 +162,9 @@ public class JDesktopPane extends JLayeredPane implements Accessible * * @param ui the DesktopPaneUI L&F object * @see UIDefaults#getUI - * @beaninfo - * bound: true - * hidden: true - * attribute: visualUpdate true - * description: The UI object that implements the Component's LookAndFeel. */ + @BeanProperty(hidden = true, visualUpdate = true, description + = "The UI object that implements the Component's LookAndFeel.") public void setUI(DesktopPaneUI ui) { super.setUI(ui); } @@ -183,13 +179,12 @@ public class JDesktopPane extends JLayeredPane implements Accessible * @see #LIVE_DRAG_MODE * @see #OUTLINE_DRAG_MODE * - * @beaninfo - * bound: true - * description: Dragging style for internal frame children. - * enum: LIVE_DRAG_MODE JDesktopPane.LIVE_DRAG_MODE - * OUTLINE_DRAG_MODE JDesktopPane.OUTLINE_DRAG_MODE * @since 1.3 */ + @BeanProperty(enumerationValues = { + "JDesktopPane.LIVE_DRAG_MODE", + "JDesktopPane.OUTLINE_DRAG_MODE"}, description + = "Dragging style for internal frame children.") public void setDragMode(int dragMode) { int oldDragMode = this.dragMode; this.dragMode = dragMode; @@ -225,12 +220,9 @@ public class JDesktopPane extends JLayeredPane implements Accessible * {@code LookAndFeel}. * * @param d the DesktopManager to use - * - * @beaninfo - * bound: true - * description: Desktop manager to handle the internal frames in the - * desktop pane. */ + @BeanProperty(description + = "Desktop manager to handle the internal frames in the desktop pane.") public void setDesktopManager(DesktopManager d) { DesktopManager oldValue = desktopManager; desktopManager = d; @@ -256,6 +248,7 @@ public class JDesktopPane extends JLayeredPane implements Accessible * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; } @@ -266,6 +259,7 @@ public class JDesktopPane extends JLayeredPane implements Accessible * * @return an array of JInternalFrame objects */ + @BeanProperty(bound = false) public JInternalFrame[] getAllFrames() { return getAllFrames(this).toArray(new JInternalFrame[0]); } @@ -600,6 +594,7 @@ public class JDesktopPane extends JLayeredPane implements Accessible * @return an AccessibleJDesktopPane that serves as the * AccessibleContext of this JDesktopPane */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJDesktopPane(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JDialog.java b/jdk/src/java.desktop/share/classes/javax/swing/JDialog.java index b33bb15f30d..29ad6f88fbb 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JDialog.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JDialog.java @@ -26,6 +26,8 @@ package javax.swing; import java.awt.*; import java.awt.event.*; +import java.beans.JavaBean; +import java.beans.BeanProperty; import javax.accessibility.*; /** @@ -86,16 +88,13 @@ import javax.accessibility.*; * @see JRootPane * @see javax.swing.RootPaneContainer * - * @beaninfo - * attribute: isContainer true - * attribute: containerDelegate getContentPane - * description: A toplevel window for creating dialog boxes. - * * @author David Kloba * @author James Gosling * @author Scott Violet * @since 1.2 */ +@JavaBean(defaultProperty = "JMenuBar", description = "A toplevel window for creating dialog boxes.") +@SwingContainer(delegate = "getContentPane") @SuppressWarnings("serial") // Same-version serialization only public class JDialog extends Dialog implements WindowConstants, Accessible, @@ -743,15 +742,12 @@ public class JDialog extends Dialog implements WindowConstants, * @see #addWindowListener * @see #getDefaultCloseOperation * @see WindowConstants - * - * @beaninfo - * preferred: true - * bound: true - * enum: DO_NOTHING_ON_CLOSE WindowConstants.DO_NOTHING_ON_CLOSE - * HIDE_ON_CLOSE WindowConstants.HIDE_ON_CLOSE - * DISPOSE_ON_CLOSE WindowConstants.DISPOSE_ON_CLOSE - * description: The dialog's default close operation. */ + @BeanProperty(preferred = true, enumerationValues = { + "WindowConstants.DO_NOTHING_ON_CLOSE", + "WindowConstants.HIDE_ON_CLOSE", + "WindowConstants.DISPOSE_ON_CLOSE"}, description + = "The dialog's default close operation.") public void setDefaultCloseOperation(int operation) { if (operation != DO_NOTHING_ON_CLOSE && operation != HIDE_ON_CLOSE && @@ -802,12 +798,9 @@ public class JDialog extends Dialog implements WindowConstants, * @see #getTransferHandler * @see java.awt.Component#setDropTarget * @since 1.6 - * - * @beaninfo - * bound: true - * hidden: true - * description: Mechanism for transfer of data into the component */ + @BeanProperty(hidden = true, description + = "Mechanism for transfer of data into the component") public void setTransferHandler(TransferHandler newHandler) { TransferHandler oldHandler = transferHandler; transferHandler = newHandler; @@ -844,11 +837,9 @@ public class JDialog extends Dialog implements WindowConstants, * @param menu the menubar being placed in the dialog * * @see #getJMenuBar - * - * @beaninfo - * hidden: true - * description: The menubar for accessing pulldown menus from this dialog. */ + @BeanProperty(bound = false, hidden = true, description + = "The menubar for accessing pulldown menus from this dialog.") public void setJMenuBar(final JMenuBar menu) { getRootPane().setJMenuBar(menu); } @@ -892,10 +883,9 @@ public class JDialog extends Dialog implements WindowConstants, * @see #setLayout * @see #isRootPaneCheckingEnabled * @see javax.swing.RootPaneContainer - * @beaninfo - * hidden: true - * description: Whether the add and setLayout methods are forwarded */ + @BeanProperty(hidden = true, description + = "Whether the add and setLayout methods are forwarded") protected void setRootPaneCheckingEnabled(boolean enabled) { rootPaneCheckingEnabled = enabled; } @@ -977,6 +967,8 @@ public class JDialog extends Dialog implements WindowConstants, * @see #setRootPane * @see RootPaneContainer#getRootPane */ + @BeanProperty(bound = false, hidden = true, description + = "the RootPane object for this dialog.") public JRootPane getRootPane() { return rootPane; } @@ -989,10 +981,6 @@ public class JDialog extends Dialog implements WindowConstants, * @param root the {@code rootPane} object for this dialog * * @see #getRootPane - * - * @beaninfo - * hidden: true - * description: the RootPane object for this dialog. */ protected void setRootPane(JRootPane root) { if(rootPane != null) { @@ -1041,12 +1029,9 @@ public class JDialog extends Dialog implements WindowConstants, * exception) if the content pane parameter is {@code null} * @see #getContentPane * @see RootPaneContainer#setContentPane - * - * @beaninfo - * hidden: true - * description: The client area of the dialog where child - * components are normally inserted. */ + @BeanProperty(bound = false, hidden = true, description + = "The client area of the dialog where child components are normally inserted.") public void setContentPane(Container contentPane) { getRootPane().setContentPane(contentPane); } @@ -1073,11 +1058,9 @@ public class JDialog extends Dialog implements WindowConstants, * exception) if the layered pane parameter is null * @see #getLayeredPane * @see RootPaneContainer#setLayeredPane - * - * @beaninfo - * hidden: true - * description: The pane which holds the various dialog layers. */ + @BeanProperty(bound = false, hidden = true, description + = "The pane which holds the various dialog layers.") public void setLayeredPane(JLayeredPane layeredPane) { getRootPane().setLayeredPane(layeredPane); } @@ -1101,11 +1084,9 @@ public class JDialog extends Dialog implements WindowConstants, * @param glassPane the {@code glassPane} object for this dialog * @see #getGlassPane * @see RootPaneContainer#setGlassPane - * - * @beaninfo - * hidden: true - * description: A transparent pane used for menu rendering. */ + @BeanProperty(bound = false, hidden = true, description + = "A transparent pane used for menu rendering.") public void setGlassPane(Component glassPane) { getRootPane().setGlassPane(glassPane); } @@ -1115,6 +1096,7 @@ public class JDialog extends Dialog implements WindowConstants, * * @since 1.6 */ + @BeanProperty(bound = false) public Graphics getGraphics() { JComponent.getGraphicsInvoked(this); return super.getGraphics(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JEditorPane.java b/jdk/src/java.desktop/share/classes/javax/swing/JEditorPane.java index cfcd56585be..3211d572c1c 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JEditorPane.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JEditorPane.java @@ -24,15 +24,13 @@ */ package javax.swing; -import sun.swing.SwingUtilities2; - import java.awt.*; -import java.awt.event.*; +import java.beans.JavaBean; +import java.beans.BeanProperty; import java.lang.reflect.*; import java.net.*; import java.util.*; import java.io.*; -import java.util.*; import javax.swing.plaf.*; import javax.swing.text.*; @@ -184,13 +182,11 @@ import sun.reflect.misc.ReflectUtil; * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. * - * @beaninfo - * attribute: isContainer false - * description: A text component to edit various types of content. - * * @author Timothy Prinzing * @since 1.2 */ +@JavaBean(defaultProperty = "UIClassID", description = "A text component to edit various types of content.") +@SwingContainer(false) @SuppressWarnings("serial") // Same-version serialization only public class JEditorPane extends JTextComponent { @@ -323,6 +319,7 @@ public class JEditorPane extends JTextComponent { * array if no listeners have been added * @since 1.4 */ + @BeanProperty(bound = false) public synchronized HyperlinkListener[] getHyperlinkListeners() { return listenerList.getListeners(javax.swing.event.HyperlinkListener.class); } @@ -411,11 +408,9 @@ public class JEditorPane extends JTextComponent { * @exception IOException for a null or invalid * page specification, or exception from the stream being read * @see #getPage - * @beaninfo - * description: the URL used to set content - * bound: true - * expert: true */ + @BeanProperty(expert = true, description + = "the URL used to set content") public void setPage(URL page) throws IOException { if (page == null) { throw new IOException("invalid url"); @@ -895,6 +890,7 @@ public class JEditorPane extends JTextComponent { * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; } @@ -960,11 +956,11 @@ public class JEditorPane extends JTextComponent { * @param type the non-null mime type for the content editing * support * @see #getContentType - * @beaninfo - * description: the type of content * @throws NullPointerException if the type parameter * is null */ + @BeanProperty(bound = false, description + = "the type of content") public final void setContentType(String type) { // The type could have optional info is part of it, // for example some charset info. We need to strip that @@ -1046,11 +1042,9 @@ public class JEditorPane extends JTextComponent { * * @param kit the desired editor behavior * @see #getEditorKit - * @beaninfo - * description: the currently installed kit for handling content - * bound: true - * expert: true */ + @BeanProperty(expert = true, description + = "the currently installed kit for handling content") public void setEditorKit(EditorKit kit) { EditorKit old = this.kit; isUserSetEditorKit = true; @@ -1414,9 +1408,9 @@ public class JEditorPane extends JTextComponent { * @param t the new text to be set; if null the old * text will be deleted * @see #getText - * @beaninfo - * description: the text of this component */ + @BeanProperty(bound = false, description + = "the text of this component") public void setText(String t) { try { Document doc = getDocument(); @@ -1466,6 +1460,7 @@ public class JEditorPane extends JTextComponent { * @return true if a viewport should force the Scrollables width to * match its own, false otherwise */ + @BeanProperty(bound = false) public boolean getScrollableTracksViewportWidth() { Container parent = SwingUtilities.getUnwrappedParent(this); if (parent instanceof JViewport) { @@ -1489,6 +1484,7 @@ public class JEditorPane extends JTextComponent { * Scrollable's height to match its own, * false otherwise */ + @BeanProperty(bound = false) public boolean getScrollableTracksViewportHeight() { Container parent = SwingUtilities.getUnwrappedParent(this); if (parent instanceof JViewport) { @@ -1626,6 +1622,7 @@ public class JEditorPane extends JTextComponent { * @return an AccessibleJEditorPane that serves as the * AccessibleContext of this JEditorPane */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (getEditorKit() instanceof HTMLEditorKit) { if (accessibleContext == null || accessibleContext.getClass() != diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JFileChooser.java b/jdk/src/java.desktop/share/classes/javax/swing/JFileChooser.java index 45a5a907f24..01edf5d0486 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JFileChooser.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JFileChooser.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ - package javax.swing; import javax.swing.event.*; @@ -48,6 +47,8 @@ import java.awt.HeadlessException; import java.awt.EventQueue; import java.awt.Toolkit; import java.awt.event.*; +import java.beans.JavaBean; +import java.beans.BeanProperty; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeEvent; import java.io.InvalidObjectException; @@ -83,13 +84,11 @@ import java.lang.ref.WeakReference; * href="package-summary.html#threading">Swing's Threading * Policy. * - * @beaninfo - * attribute: isContainer false - * description: A component which allows for the interactive selection of a file. - * * @author Jeff Dinkins * @since 1.2 */ +@JavaBean(defaultProperty = "UI", description = "A component which allows for the interactive selection of a file.") +@SwingContainer(false) @SuppressWarnings("serial") // Superclass is not serializable across versions public class JFileChooser extends JComponent implements Accessible { @@ -456,11 +455,9 @@ public class JFileChooser extends JComponent implements Accessible { * @see #setTransferHandler * @see TransferHandler * @since 1.4 - * - * @beaninfo - * description: determines whether automatic drag handling is enabled - * bound: false */ + @BeanProperty(bound = false, description + = "determines whether automatic drag handling is enabled") public void setDragEnabled(boolean b) { checkDragEnabled(b); dragEnabled = b; @@ -505,14 +502,11 @@ public class JFileChooser extends JComponent implements Accessible { * not the current directory, changes the current directory * to be the file's parent directory. * - * @beaninfo - * preferred: true - * bound: true - * * @see #getSelectedFile * * @param file the selected file */ + @BeanProperty(preferred = true) public void setSelectedFile(File file) { File oldValue = selectedFile; selectedFile = file; @@ -546,10 +540,9 @@ public class JFileChooser extends JComponent implements Accessible { * set to allow multiple selection. * * @param selectedFiles an array {@code File}s to be selected - * @beaninfo - * bound: true - * description: The list of selected files if the chooser is in multiple selection mode. */ + @BeanProperty(description + = "The list of selected files if the chooser is in multiple selection mode.") public void setSelectedFiles(File[] selectedFiles) { File[] oldValue = this.selectedFiles; if (selectedFiles == null || selectedFiles.length == 0) { @@ -586,14 +579,11 @@ public class JFileChooser extends JComponent implements Accessible { * until it finds a traversable directory, or hits the root of the * file system. * - * @beaninfo - * preferred: true - * bound: true - * description: The directory that the JFileChooser is showing files of. - * * @param dir the current directory to point to * @see #getCurrentDirectory */ + @BeanProperty(preferred = true, description + = "The directory that the JFileChooser is showing files of.") public void setCurrentDirectory(File dir) { File oldValue = currentDirectory; @@ -881,15 +871,12 @@ public class JFileChooser extends JComponent implements Accessible { * @param b false if control buttons should not be * shown; otherwise, true * - * @beaninfo - * preferred: true - * bound: true - * description: Sets whether the approve & cancel buttons are shown. - * * @see #getControlButtonsAreShown * @see #CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY * @since 1.3 */ + @BeanProperty(preferred = true, description + = "Sets whether the approve & cancel buttons are shown.") public void setControlButtonsAreShown(boolean b) { if(controlsShown == b) { return; @@ -939,19 +926,16 @@ public class JFileChooser extends JComponent implements Accessible { * * @exception IllegalArgumentException if dialogType is * not legal - * @beaninfo - * preferred: true - * bound: true - * description: The type (open, save, custom) of the JFileChooser. - * enum: - * OPEN_DIALOG JFileChooser.OPEN_DIALOG - * SAVE_DIALOG JFileChooser.SAVE_DIALOG - * CUSTOM_DIALOG JFileChooser.CUSTOM_DIALOG * * @see #getDialogType * @see #setApproveButtonText */ // PENDING(jeff) - fire button text change property + @BeanProperty(preferred = true, enumerationValues = { + "JFileChooser.OPEN_DIALOG", + "JFileChooser.SAVE_DIALOG", + "JFileChooser.CUSTOM_DIALOG"}, description + = "The type (open, save, custom) of the JFileChooser.") public void setDialogType(int dialogType) { if(this.dialogType == dialogType) { return; @@ -979,14 +963,11 @@ public class JFileChooser extends JComponent implements Accessible { * * @param dialogTitle the new String for the title bar * - * @beaninfo - * preferred: true - * bound: true - * description: The title of the JFileChooser dialog window. - * * @see #getDialogTitle * */ + @BeanProperty(preferred = true, description + = "The title of the JFileChooser dialog window.") public void setDialogTitle(String dialogTitle) { String oldValue = this.dialogTitle; this.dialogTitle = dialogTitle; @@ -1016,16 +997,13 @@ public class JFileChooser extends JComponent implements Accessible { * Sets the tooltip text used in the ApproveButton. * If null, the UI object will determine the button's text. * - * @beaninfo - * preferred: true - * bound: true - * description: The tooltip text for the ApproveButton. - * * @param toolTipText the tooltip text for the approve button * @see #setApproveButtonText * @see #setDialogType * @see #showDialog */ + @BeanProperty(preferred = true, description + = "The tooltip text for the ApproveButton.") public void setApproveButtonToolTipText(String toolTipText) { if(approveButtonToolTipText == toolTipText) { return; @@ -1065,13 +1043,10 @@ public class JFileChooser extends JComponent implements Accessible { * * @param mnemonic an integer value for the mnemonic key * - * @beaninfo - * preferred: true - * bound: true - * description: The mnemonic key accelerator for the ApproveButton. - * * @see #getApproveButtonMnemonic */ + @BeanProperty(preferred = true, description + = "The mnemonic key accelerator for the ApproveButton.") public void setApproveButtonMnemonic(int mnemonic) { if(approveButtonMnemonic == mnemonic) { return; @@ -1100,11 +1075,6 @@ public class JFileChooser extends JComponent implements Accessible { * Sets the text used in the ApproveButton in the * FileChooserUI. * - * @beaninfo - * preferred: true - * bound: true - * description: The text that goes in the ApproveButton. - * * @param approveButtonText the text used in the ApproveButton * * @see #getApproveButtonText @@ -1112,6 +1082,8 @@ public class JFileChooser extends JComponent implements Accessible { * @see #showDialog */ // PENDING(jeff) - have ui set this on dialog type change + @BeanProperty(preferred = true, description + = "The text that goes in the ApproveButton.") public void setApproveButtonText(String approveButtonText) { if(this.approveButtonText == approveButtonText) { return; @@ -1148,6 +1120,7 @@ public class JFileChooser extends JComponent implements Accessible { * @see #removeChoosableFileFilter * @see #resetChoosableFileFilters */ + @BeanProperty(bound = false) public FileFilter[] getChoosableFileFilters() { FileFilter[] filterArray = new FileFilter[filters.size()]; filters.copyInto(filterArray); @@ -1162,16 +1135,13 @@ public class JFileChooser extends JComponent implements Accessible { * @param filter the FileFilter to add to the choosable file * filter list * - * @beaninfo - * preferred: true - * bound: true - * description: Adds a filter to the list of user choosable file filters. - * * @see #getChoosableFileFilters * @see #removeChoosableFileFilter * @see #resetChoosableFileFilters * @see #setFileSelectionMode */ + @BeanProperty(preferred = true, description + = "Adds a filter to the list of user choosable file filters.") public void addChoosableFileFilter(FileFilter filter) { if(filter != null && !filters.contains(filter)) { FileFilter[] oldValue = getChoosableFileFilters(); @@ -1249,6 +1219,7 @@ public class JFileChooser extends JComponent implements Accessible { * * @return the {@code AcceptAll} file filter */ + @BeanProperty(bound = false) public FileFilter getAcceptAllFileFilter() { FileFilter filter = null; if(getUI() != null) { @@ -1277,16 +1248,14 @@ public class JFileChooser extends JComponent implements Accessible { * * @param b a {@code boolean} which determines whether the {@code AcceptAll} * file filter is an available choice in the choosable filter list - * @beaninfo - * preferred: true - * bound: true - * description: Sets whether the AcceptAll FileFilter is used as an available choice in the choosable filter list. * * @see #isAcceptAllFileFilterUsed * @see #getAcceptAllFileFilter * @see #setFileFilter * @since 1.3 */ + @BeanProperty(preferred = true, description + = "Sets whether the AcceptAll FileFilter is used as an available choice in the choosable filter list.") public void setAcceptAllFileFilterUsed(boolean b) { boolean oldValue = useAcceptAllFileFilter; useAcceptAllFileFilter = b; @@ -1320,11 +1289,9 @@ public class JFileChooser extends JComponent implements Accessible { * file chooser. * * @param newAccessory the accessory component to be set - * @beaninfo - * preferred: true - * bound: true - * description: Sets the accessory component on the JFileChooser. */ + @BeanProperty(preferred = true, description + = "Sets the accessory component on the JFileChooser.") public void setAccessory(JComponent newAccessory) { JComponent oldValue = accessory; accessory = newAccessory; @@ -1346,17 +1313,14 @@ public class JFileChooser extends JComponent implements Accessible { * * @exception IllegalArgumentException if mode is an * illegal file selection mode - * @beaninfo - * preferred: true - * bound: true - * description: Sets the types of files that the JFileChooser can choose. - * enum: FILES_ONLY JFileChooser.FILES_ONLY - * DIRECTORIES_ONLY JFileChooser.DIRECTORIES_ONLY - * FILES_AND_DIRECTORIES JFileChooser.FILES_AND_DIRECTORIES - * * * @see #getFileSelectionMode */ + @BeanProperty(preferred = true, enumerationValues = { + "JFileChooser.FILES_ONLY", + "JFileChooser.DIRECTORIES_ONLY", + "JFileChooser.FILES_AND_DIRECTORIES"}, description + = "Sets the types of files that the JFileChooser can choose.") public void setFileSelectionMode(int mode) { if(fileSelectionMode == mode) { return; @@ -1400,6 +1364,7 @@ public class JFileChooser extends JComponent implements Accessible { * @see #setFileSelectionMode * @see #getFileSelectionMode */ + @BeanProperty(bound = false) public boolean isFileSelectionEnabled() { return ((fileSelectionMode == FILES_ONLY) || (fileSelectionMode == FILES_AND_DIRECTORIES)); } @@ -1412,6 +1377,7 @@ public class JFileChooser extends JComponent implements Accessible { * @see #setFileSelectionMode * @see #getFileSelectionMode */ + @BeanProperty(bound = false) public boolean isDirectorySelectionEnabled() { return ((fileSelectionMode == DIRECTORIES_ONLY) || (fileSelectionMode == FILES_AND_DIRECTORIES)); } @@ -1420,12 +1386,11 @@ public class JFileChooser extends JComponent implements Accessible { * Sets the file chooser to allow multiple file selections. * * @param b true if multiple files may be selected - * @beaninfo - * bound: true - * description: Sets multiple file selection mode. * * @see #isMultiSelectionEnabled */ + @BeanProperty(description + = "Sets multiple file selection mode.") public void setMultiSelectionEnabled(boolean b) { if(multiSelectionEnabled == b) { return; @@ -1461,15 +1426,12 @@ public class JFileChooser extends JComponent implements Accessible { * in the file chooser. The job of determining which files are * shown is done by the FileView. * - * @beaninfo - * preferred: true - * bound: true - * description: Sets file hiding on or off. - * * @param b the boolean value that determines whether file hiding is * turned on * @see #isFileHidingEnabled */ + @BeanProperty(preferred = true, description + = "Sets file hiding on or off.") public void setFileHidingEnabled(boolean b) { // Dump showFilesListener since we'll ignore it from now on if (showFilesListener != null) { @@ -1485,14 +1447,11 @@ public class JFileChooser extends JComponent implements Accessible { * Sets the current file filter. The file filter is used by the * file chooser to filter out files from the user's view. * - * @beaninfo - * preferred: true - * bound: true - * description: Sets the File Filter used to filter out files of type. - * * @param filter the new current file filter to use * @see #getFileFilter */ + @BeanProperty(preferred = true, description + = "Sets the File Filter used to filter out files of type.") public void setFileFilter(FileFilter filter) { FileFilter oldValue = fileFilter; fileFilter = filter; @@ -1534,13 +1493,11 @@ public class JFileChooser extends JComponent implements Accessible { * the icon that represents a file or the type description of a file. * * @param fileView a {@code FileView} to be used to retrieve UI information - * @beaninfo - * preferred: true - * bound: true - * description: Sets the File View used to get file type information. * * @see #getFileView */ + @BeanProperty(preferred = true, description + = "Sets the File View used to get file type information.") public void setFileView(FileView fileView) { FileView oldValue = this.fileView; this.fileView = fileView; @@ -1704,13 +1661,10 @@ public class JFileChooser extends JComponent implements Accessible { * the floppy drive and getting a list of root drives. * @param fsv the new FileSystemView * - * @beaninfo - * expert: true - * bound: true - * description: Sets the FileSytemView used to get filesystem information. - * * @see FileSystemView */ + @BeanProperty(expert = true, description + = "Sets the FileSytemView used to get filesystem information.") public void setFileSystemView(FileSystemView fsv) { FileSystemView oldValue = fileSystemView; fileSystemView = fsv; @@ -1801,6 +1755,7 @@ public class JFileChooser extends JComponent implements Accessible { * * @since 1.4 */ + @BeanProperty(bound = false) public ActionListener[] getActionListeners() { return listenerList.getListeners(ActionListener.class); } @@ -1895,10 +1850,9 @@ public class JFileChooser extends JComponent implements Accessible { * @return the string "FileChooserUI" * @see JComponent#getUIClassID * @see UIDefaults#getUI - * @beaninfo - * expert: true - * description: A string that specifies the name of the L&F class. */ + @BeanProperty(bound = false, expert = true, description + = "A string that specifies the name of the L&F class.") public String getUIClassID() { return uiClassID; } @@ -1908,6 +1862,7 @@ public class JFileChooser extends JComponent implements Accessible { * * @return the FileChooserUI object that implements the FileChooserUI L&F */ + @BeanProperty(bound = false) public FileChooserUI getUI() { return (FileChooserUI) ui; } @@ -2070,6 +2025,7 @@ public class JFileChooser extends JComponent implements Accessible { * @return an AccessibleJFileChooser that serves as the * AccessibleContext of this JFileChooser */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJFileChooser(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JFormattedTextField.java b/jdk/src/java.desktop/share/classes/javax/swing/JFormattedTextField.java index e15d327a0f8..b30f3a52f7f 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JFormattedTextField.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JFormattedTextField.java @@ -27,6 +27,8 @@ package javax.swing; import java.awt.*; import java.awt.event.*; import java.awt.im.InputContext; +import java.beans.BeanProperty; +import java.beans.JavaBean; import java.io.*; import java.text.*; import java.util.*; @@ -176,6 +178,7 @@ import javax.swing.text.*; * * @since 1.4 */ +@JavaBean @SuppressWarnings("serial") // Same-version serialization only public class JFormattedTextField extends JTextField { private static final String uiClassID = "FormattedTextFieldUI"; @@ -357,13 +360,13 @@ public class JFormattedTextField extends JTextField { * @param behavior Identifies behavior when focus is lost * @throws IllegalArgumentException if behavior is not one of the known * values - * @beaninfo - * enum: COMMIT JFormattedTextField.COMMIT - * COMMIT_OR_REVERT JFormattedTextField.COMMIT_OR_REVERT - * REVERT JFormattedTextField.REVERT - * PERSIST JFormattedTextField.PERSIST - * description: Behavior when component loses focus */ + @BeanProperty(bound = false, enumerationValues = { + "JFormattedTextField.COMMIT", + "JFormattedTextField.COMMIT_OR_REVERT", + "JFormattedTextField.REVERT", + "JFormattedTextField.PERSIST"}, description + = "Behavior when component loses focus") public void setFocusLostBehavior(int behavior) { if (behavior != COMMIT && behavior != COMMIT_OR_REVERT && behavior != PERSIST && behavior != REVERT) { @@ -407,12 +410,9 @@ public class JFormattedTextField extends JTextField { * * @param tf AbstractFormatterFactory used to lookup * instances of AbstractFormatter - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: AbstractFormatterFactory, responsible for returning an - * AbstractFormatter that can format the current value. */ + @BeanProperty(visualUpdate = true, description + = "AbstractFormatterFactory, responsible for returning an AbstractFormatter that can format the current value.") public void setFormatterFactory(AbstractFormatterFactory tf) { AbstractFormatterFactory oldFactory = factory; @@ -448,10 +448,6 @@ public class JFormattedTextField extends JTextField { * * @see #setFormatterFactory * @param format AbstractFormatter to use for formatting - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: TextFormatter, responsible for formatting the current value */ protected void setFormatter(AbstractFormatter format) { AbstractFormatter oldFormat = this.format; @@ -474,6 +470,8 @@ public class JFormattedTextField extends JTextField { * * @return AbstractFormatter used for formatting */ + @BeanProperty(visualUpdate = true, description + = "TextFormatter, responsible for formatting the current value") public AbstractFormatter getFormatter() { return format; } @@ -490,11 +488,9 @@ public class JFormattedTextField extends JTextField { * This is a JavaBeans bound property. * * @param value Current value to display - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: The value to be formatted. */ + @BeanProperty(visualUpdate = true, description + = "The value to be formatted.") public void setValue(Object value) { if (value != null && getFormatterFactory() == null) { setFormatterFactory(getDefaultFormatterFactory(value)); @@ -544,11 +540,9 @@ public class JFormattedTextField extends JTextField { * * @param isValid boolean indicating if the currently edited value is * valid. - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: True indicates the edited value is valid */ + @BeanProperty(visualUpdate = true, description + = "True indicates the edited value is valid") private void setEditValid(boolean isValid) { if (isValid != editValid) { editValid = isValid; @@ -564,6 +558,7 @@ public class JFormattedTextField extends JTextField { * * @return true if the current value being edited is valid. */ + @BeanProperty(bound = false) public boolean isEditValid() { return editValid; } @@ -673,6 +668,7 @@ public class JFormattedTextField extends JTextField { * * @return the command list */ + @BeanProperty(bound = false) public Action[] getActions() { return TextAction.augmentList(super.getActions(), defaultActions); } @@ -683,6 +679,7 @@ public class JFormattedTextField extends JTextField { * @return the string "FormattedTextFieldUI" * @see JComponent#getUIClassID */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; } @@ -695,11 +692,9 @@ public class JFormattedTextField extends JTextField { * * @param doc the document to display/edit * @see #getDocument - * @beaninfo - * description: the text document model - * bound: true - * expert: true */ + @BeanProperty(expert = true, description + = "the text document model") public void setDocument(Document doc) { if (documentListener != null && getDocument() != null) { getDocument().removeDocumentListener(documentListener); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JFrame.java b/jdk/src/java.desktop/share/classes/javax/swing/JFrame.java index c8415e70f58..275137d503a 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JFrame.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JFrame.java @@ -36,12 +36,14 @@ import java.awt.Image; import java.awt.LayoutManager; import java.awt.event.WindowEvent; +import java.beans.JavaBean; +import java.beans.BeanProperty; + import javax.accessibility.Accessible; import javax.accessibility.AccessibleContext; import javax.accessibility.AccessibleState; import javax.accessibility.AccessibleStateSet; - /** * An extended version of java.awt.Frame that adds support for * the JFC/Swing component architecture. @@ -111,16 +113,13 @@ import javax.accessibility.AccessibleStateSet; * @see java.awt.event.WindowListener#windowClosing * @see javax.swing.RootPaneContainer * - * @beaninfo - * attribute: isContainer true - * attribute: containerDelegate getContentPane - * description: A toplevel window which can be minimized to an icon. - * * @author Jeff Dinkins * @author Georges Saab * @author David Kloba * @since 1.2 */ +@JavaBean(defaultProperty = "JMenuBar", description = "A toplevel window which can be minimized to an icon.") +@SwingContainer(delegate = "getContentPane") @SuppressWarnings("serial") // Same-version serialization only public class JFrame extends Frame implements WindowConstants, Accessible, @@ -368,16 +367,13 @@ public class JFrame extends Frame implements WindowConstants, * SecurityManager will * not allow the caller to invoke System.exit * @see java.lang.Runtime#exit(int) - * - * @beaninfo - * preferred: true - * bound: true - * enum: DO_NOTHING_ON_CLOSE WindowConstants.DO_NOTHING_ON_CLOSE - * HIDE_ON_CLOSE WindowConstants.HIDE_ON_CLOSE - * DISPOSE_ON_CLOSE WindowConstants.DISPOSE_ON_CLOSE - * EXIT_ON_CLOSE WindowConstants.EXIT_ON_CLOSE - * description: The frame's default close operation. */ + @BeanProperty(preferred = true, enumerationValues = { + "WindowConstants.DO_NOTHING_ON_CLOSE", + "WindowConstants.HIDE_ON_CLOSE", + "WindowConstants.DISPOSE_ON_CLOSE", + "WindowConstants.EXIT_ON_CLOSE"}, description + = "The frame's default close operation.") public void setDefaultCloseOperation(int operation) { if (operation != DO_NOTHING_ON_CLOSE && operation != HIDE_ON_CLOSE && @@ -440,12 +436,9 @@ public class JFrame extends Frame implements WindowConstants, * @see #getTransferHandler * @see java.awt.Component#setDropTarget * @since 1.6 - * - * @beaninfo - * bound: true - * hidden: true - * description: Mechanism for transfer of data into the component */ + @BeanProperty(hidden = true, description + = "Mechanism for transfer of data into the component") public void setTransferHandler(TransferHandler newHandler) { TransferHandler oldHandler = transferHandler; transferHandler = newHandler; @@ -481,11 +474,9 @@ public class JFrame extends Frame implements WindowConstants, * @param menubar the menubar being placed in the frame * * @see #getJMenuBar - * - * @beaninfo - * hidden: true - * description: The menubar for accessing pulldown menus from this frame. */ + @BeanProperty(bound = false, hidden = true, description + = "The menubar for accessing pulldown menus from this frame.") public void setJMenuBar(final JMenuBar menubar) { getRootPane().setJMenuBar(menubar); } @@ -529,10 +520,9 @@ public class JFrame extends Frame implements WindowConstants, * @see #setLayout * @see #isRootPaneCheckingEnabled * @see javax.swing.RootPaneContainer - * @beaninfo - * hidden: true - * description: Whether the add and setLayout methods are forwarded */ + @BeanProperty(hidden = true, description + = "Whether the add and setLayout methods are forwarded") protected void setRootPaneCheckingEnabled(boolean enabled) { rootPaneCheckingEnabled = enabled; } @@ -616,6 +606,8 @@ public class JFrame extends Frame implements WindowConstants, * @see #setRootPane * @see RootPaneContainer#getRootPane */ + @BeanProperty(bound = false, hidden = true, description + = "the RootPane object for this frame.") public JRootPane getRootPane() { return rootPane; } @@ -627,10 +619,6 @@ public class JFrame extends Frame implements WindowConstants, * @param root the rootPane object for this frame * * @see #getRootPane - * - * @beaninfo - * hidden: true - * description: the RootPane object for this frame. */ protected void setRootPane(JRootPane root) { @@ -684,12 +672,9 @@ public class JFrame extends Frame implements WindowConstants, * @see #getContentPane * @see RootPaneContainer#setContentPane * @see JRootPane - * - * @beaninfo - * hidden: true - * description: The client area of the frame where child - * components are normally inserted. */ + @BeanProperty(bound = false, hidden = true, description + = "The client area of the frame where child components are normally inserted.") public void setContentPane(Container contentPane) { getRootPane().setContentPane(contentPane); } @@ -714,11 +699,9 @@ public class JFrame extends Frame implements WindowConstants, * exception) if the layered pane parameter is null * @see #getLayeredPane * @see RootPaneContainer#setLayeredPane - * - * @beaninfo - * hidden: true - * description: The pane that holds the various frame layers. */ + @BeanProperty(bound = false, hidden = true, description + = "The pane that holds the various frame layers.") public void setLayeredPane(JLayeredPane layeredPane) { getRootPane().setLayeredPane(layeredPane); } @@ -741,11 +724,9 @@ public class JFrame extends Frame implements WindowConstants, * * @see #getGlassPane * @see RootPaneContainer#setGlassPane - * - * @beaninfo - * hidden: true - * description: A transparent pane used for menu rendering. */ + @BeanProperty(bound = false, hidden = true, description + = "A transparent pane used for menu rendering.") public void setGlassPane(Component glassPane) { getRootPane().setGlassPane(glassPane); } @@ -755,6 +736,7 @@ public class JFrame extends Frame implements WindowConstants, * * @since 1.6 */ + @BeanProperty(bound = false) public Graphics getGraphics() { JComponent.getGraphicsInvoked(this); return super.getGraphics(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JInternalFrame.java b/jdk/src/java.desktop/share/classes/javax/swing/JInternalFrame.java index 8860915a82e..2297fdacdc0 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JInternalFrame.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JInternalFrame.java @@ -27,8 +27,7 @@ package javax.swing; import java.awt.*; -import java.beans.PropertyVetoException; -import java.beans.PropertyChangeEvent; +import java.beans.*; import javax.swing.event.InternalFrameEvent; import javax.swing.event.InternalFrameListener; @@ -38,7 +37,7 @@ import javax.accessibility.*; import java.io.ObjectOutputStream; import java.io.IOException; -import java.beans.PropertyChangeListener; + import sun.awt.AppContext; import sun.swing.SwingUtilities2; @@ -104,12 +103,9 @@ import sun.swing.SwingUtilities2; * @author David Kloba * @author Rich Schiavi * @since 1.2 - * @beaninfo - * attribute: isContainer true - * attribute: containerDelegate getContentPane - * description: A frame container which is contained within - * another window. */ +@JavaBean(defaultProperty = "JMenuBar", description = "A frame container which is contained within another window.") +@SwingContainer(delegate = "getContentPane") @SuppressWarnings("serial") // Same-version serialization only public class JInternalFrame extends JComponent implements Accessible, WindowConstants, @@ -377,12 +373,9 @@ public class JInternalFrame extends JComponent implements /** * Sets the UI delegate for this JInternalFrame. * @param ui the UI delegate - * @beaninfo - * bound: true - * hidden: true - * attribute: visualUpdate true - * description: The UI object that implements the Component's LookAndFeel. */ + @BeanProperty(hidden = true, visualUpdate = true, description + = "The UI object that implements the Component's LookAndFeel.") public void setUI(InternalFrameUI ui) { boolean checkingEnabled = isRootPaneCheckingEnabled(); try { @@ -434,10 +427,9 @@ public class JInternalFrame extends JComponent implements * * @see JComponent#getUIClassID * @see UIDefaults#getUI - * - * @beaninfo - * description: UIClassID */ + @BeanProperty(bound = false, description + = "UIClassID") public String getUIClassID() { return uiClassID; } @@ -470,10 +462,9 @@ public class JInternalFrame extends JComponent implements * @see #setLayout * @see #isRootPaneCheckingEnabled * @see javax.swing.RootPaneContainer - * @beaninfo - * hidden: true - * description: Whether the add and setLayout methods are forwarded */ + @BeanProperty(hidden = true, description + = "Whether the add and setLayout methods are forwarded") protected void setRootPaneCheckingEnabled(boolean enabled) { rootPaneCheckingEnabled = enabled; } @@ -595,12 +586,9 @@ public class JInternalFrame extends JComponent implements * * @param m the JMenuBar to use in this internal frame * @see #getJMenuBar - * @beaninfo - * bound: true - * preferred: true - * description: The menu bar for accessing pulldown menus - * from this internal frame. */ + @BeanProperty(preferred = true, description + = "The menu bar for accessing pulldown menus from this internal frame.") public void setJMenuBar(JMenuBar m){ JMenuBar oldValue = getMenuBar(); getRootPane().setJMenuBar(m); @@ -626,12 +614,9 @@ public class JInternalFrame extends JComponent implements * @exception java.awt.IllegalComponentStateException (a runtime * exception) if the content pane parameter is null * @see RootPaneContainer#getContentPane - * @beaninfo - * bound: true - * hidden: true - * description: The client area of the internal frame where child - * components are normally inserted. */ + @BeanProperty(hidden = true, description + = "The client area of the internal frame where child components are normally inserted.") public void setContentPane(Container c) { Container oldValue = getContentPane(); getRootPane().setContentPane(c); @@ -658,11 +643,9 @@ public class JInternalFrame extends JComponent implements * @exception java.awt.IllegalComponentStateException (a runtime * exception) if the layered pane parameter is null * @see RootPaneContainer#setLayeredPane - * @beaninfo - * hidden: true - * bound: true - * description: The pane which holds the various desktop layers. */ + @BeanProperty(hidden = true, description + = "The pane which holds the various desktop layers.") public void setLayeredPane(JLayeredPane layered) { JLayeredPane oldValue = getLayeredPane(); getRootPane().setLayeredPane(layered); @@ -685,11 +668,9 @@ public class JInternalFrame extends JComponent implements * * @param glass the glass pane for this internal frame * @see RootPaneContainer#getGlassPane - * @beaninfo - * bound: true - * hidden: true - * description: A transparent pane used for menu rendering. */ + @BeanProperty(hidden = true, description + = "A transparent pane used for menu rendering.") public void setGlassPane(Component glass) { Component oldValue = getGlassPane(); getRootPane().setGlassPane(glass); @@ -702,6 +683,8 @@ public class JInternalFrame extends JComponent implements * @return the rootPane property * @see RootPaneContainer#getRootPane */ + @BeanProperty(hidden = true, description + = "The root pane used by this internal frame.") public JRootPane getRootPane() { return rootPane; } @@ -713,10 +696,6 @@ public class JInternalFrame extends JComponent implements * This method is called by the constructor. * * @param root the new JRootPane object - * @beaninfo - * bound: true - * hidden: true - * description: The root pane used by this internal frame. */ protected void setRootPane(JRootPane root) { if(rootPane != null) { @@ -741,11 +720,9 @@ public class JInternalFrame extends JComponent implements * Sets whether this JInternalFrame can be closed by * some user action. * @param b a boolean value, where true means this internal frame can be closed - * @beaninfo - * preferred: true - * bound: true - * description: Indicates whether this internal frame can be closed. */ + @BeanProperty(preferred = true, description + = "Indicates whether this internal frame can be closed.") public void setClosable(boolean b) { Boolean oldValue = closable ? Boolean.TRUE : Boolean.FALSE; Boolean newValue = b ? Boolean.TRUE : Boolean.FALSE; @@ -807,12 +784,9 @@ public class JInternalFrame extends JComponent implements * @see #setDefaultCloseOperation * @see #dispose * @see javax.swing.event.InternalFrameEvent#INTERNAL_FRAME_CLOSING - * - * @beaninfo - * bound: true - * constrained: true - * description: Indicates whether this internal frame has been closed. */ + @BeanProperty(description + = "Indicates whether this internal frame has been closed.") public void setClosed(boolean b) throws PropertyVetoException { if (isClosed == b) { return; @@ -844,12 +818,9 @@ public class JInternalFrame extends JComponent implements * user action. * * @param b a boolean, where true means this internal frame can be resized - * @beaninfo - * preferred: true - * bound: true - * description: Determines whether this internal frame can be resized - * by the user. */ + @BeanProperty(preferred = true, description + = "Determines whether this internal frame can be resized by the user.") public void setResizable(boolean b) { Boolean oldValue = resizable ? Boolean.TRUE : Boolean.FALSE; Boolean newValue = b ? Boolean.TRUE : Boolean.FALSE; @@ -877,11 +848,9 @@ public class JInternalFrame extends JComponent implements * they will ignore this property. * * @param b a boolean, where true means this internal frame can be iconified - * @beaninfo - * preferred: true - bound: true - * description: Determines whether this internal frame can be iconified. */ + @BeanProperty(preferred = true, description + = "Determines whether this internal frame can be iconified.") public void setIconifiable(boolean b) { Boolean oldValue = iconable ? Boolean.TRUE : Boolean.FALSE; Boolean newValue = b ? Boolean.TRUE : Boolean.FALSE; @@ -925,12 +894,9 @@ public class JInternalFrame extends JComponent implements * * @see InternalFrameEvent#INTERNAL_FRAME_ICONIFIED * @see InternalFrameEvent#INTERNAL_FRAME_DEICONIFIED - * - * @beaninfo - * bound: true - * constrained: true - * description: The image displayed when this internal frame is minimized. */ + @BeanProperty(description + = "The image displayed when this internal frame is minimized.") public void setIcon(boolean b) throws PropertyVetoException { if (isIcon == b) { return; @@ -964,11 +930,9 @@ public class JInternalFrame extends JComponent implements * they will ignore this property. * * @param b true to specify that this internal frame should be maximizable; false to specify that it should not be - * @beaninfo - * bound: true - * preferred: true - * description: Determines whether this internal frame can be maximized. */ + @BeanProperty(preferred = true, description + = "Determines whether this internal frame can be maximized.") public void setMaximizable(boolean b) { Boolean oldValue = maximizable ? Boolean.TRUE : Boolean.FALSE; Boolean newValue = b ? Boolean.TRUE : Boolean.FALSE; @@ -1006,11 +970,9 @@ public class JInternalFrame extends JComponent implements * restores it * @exception PropertyVetoException when the attempt to set the * property is vetoed by the JInternalFrame - * @beaninfo - * bound: true - * constrained: true - * description: Indicates whether this internal frame is maximized. */ + @BeanProperty(description + = "Indicates whether this internal frame is maximized.") public void setMaximum(boolean b) throws PropertyVetoException { if (isMaximum == b) { return; @@ -1042,11 +1004,9 @@ public class JInternalFrame extends JComponent implements * @see #getTitle * * @param title the String to display in the title bar - * @beaninfo - * preferred: true - * bound: true - * description: The text displayed in the title bar. */ + @BeanProperty(preferred = true, description + = "The text displayed in the title bar.") public void setTitle(String title) { String oldValue = this.title; this.title = title; @@ -1076,13 +1036,9 @@ public class JInternalFrame extends JComponent implements * @see #isShowing * @see InternalFrameEvent#INTERNAL_FRAME_ACTIVATED * @see InternalFrameEvent#INTERNAL_FRAME_DEACTIVATED - * - * @beaninfo - * constrained: true - * bound: true - * description: Indicates whether this internal frame is currently - * the active frame. */ + @BeanProperty(description + = "Indicates whether this internal frame is currently the active frame.") public void setSelected(boolean selected) throws PropertyVetoException { // The InternalFrame may already be selected, but the focus // may be outside it, so restore the focus to the subcomponent @@ -1153,10 +1109,9 @@ public class JInternalFrame extends JComponent implements * * @param icon the Icon to display in the title bar * @see #getFrameIcon - * @beaninfo - * bound: true - * description: The icon shown in the top-left corner of this internal frame. */ + @BeanProperty(description + = "The icon shown in the top-left corner of this internal frame.") public void setFrameIcon(Icon icon) { Icon oldIcon = frameIcon; frameIcon = icon; @@ -1214,6 +1169,7 @@ public class JInternalFrame extends JComponent implements * @return the last non-resizable Cursor * @since 1.6 */ + @BeanProperty(bound = false) public Cursor getLastCursor() { return lastCursor; } @@ -1249,10 +1205,9 @@ public class JInternalFrame extends JComponent implements * frame's desktop layer * @throws NullPointerException if {@code layer} is {@code null} * @see JLayeredPane - * @beaninfo - * expert: true - * description: Specifies what desktop layer is used. */ + @BeanProperty(bound = false, expert = true, description + = "Specifies what desktop layer is used.") public void setLayer(Integer layer) { if(getParent() != null && getParent() instanceof JLayeredPane) { // Normally we want to do this, as it causes the LayeredPane @@ -1280,10 +1235,9 @@ public class JInternalFrame extends JComponent implements * * @see #setLayer(Integer) * @see JLayeredPane - * @beaninfo - * expert: true - * description: Specifies what desktop layer is used. */ + @BeanProperty(bound = false, expert = true, description + = "Specifies what desktop layer is used.") public void setLayer(int layer) { this.setLayer(Integer.valueOf(layer)); } @@ -1307,6 +1261,7 @@ public class JInternalFrame extends JComponent implements * @return the JDesktopPane this internal frame belongs to, * or null if none is found */ + @BeanProperty(bound = false) public JDesktopPane getDesktopPane() { Container p; @@ -1331,10 +1286,9 @@ public class JInternalFrame extends JComponent implements * * @param d the JDesktopIcon to display on the desktop * @see #getDesktopIcon - * @beaninfo - * bound: true - * description: The icon shown when this internal frame is minimized. */ + @BeanProperty(description + = "The icon shown when this internal frame is minimized.") public void setDesktopIcon(JDesktopIcon d) { JDesktopIcon oldValue = getDesktopIcon(); desktopIcon = d; @@ -1424,6 +1378,7 @@ public class JInternalFrame extends JComponent implements * @see #isSelected * @since 1.4 */ + @BeanProperty(bound = false) public Component getMostRecentFocusOwner() { if (isSelected()) { return getFocusOwner(); @@ -1538,6 +1493,7 @@ public class JInternalFrame extends JComponent implements * * @see #addInternalFrameListener */ + @BeanProperty(bound = false) public InternalFrameListener[] getInternalFrameListeners() { return listenerList.getListeners(InternalFrameListener.class); } @@ -1871,6 +1827,7 @@ public class JInternalFrame extends JComponent implements * @see java.awt.Container#isFocusCycleRoot() * @since 1.4 */ + @BeanProperty(bound = false) public final Container getFocusCycleRootAncestor() { return null; } @@ -1883,6 +1840,7 @@ public class JInternalFrame extends JComponent implements * @return null * @see java.awt.Window#getWarningString */ + @BeanProperty(bound = false) public final String getWarningString() { return null; } @@ -2018,6 +1976,7 @@ public class JInternalFrame extends JComponent implements * JInternalFrame * @see AccessibleJInternalFrame */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJInternalFrame(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JLabel.java b/jdk/src/java.desktop/share/classes/javax/swing/JLabel.java index 3191f84ccf5..6426c7de84f 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JLabel.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JLabel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,28 +22,23 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ - package javax.swing; import java.awt.Component; -import java.awt.Font; import java.awt.Image; import java.awt.*; import java.text.*; import java.awt.geom.*; +import java.beans.JavaBean; +import java.beans.BeanProperty; import java.beans.Transient; import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; import java.io.IOException; import javax.swing.plaf.LabelUI; import javax.accessibility.*; import javax.swing.text.*; -import javax.swing.text.html.*; -import javax.swing.plaf.basic.*; -import java.util.*; - /** * A display area for a short text string or an image, @@ -98,13 +93,11 @@ import java.util.*; * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. * - * @beaninfo - * attribute: isContainer false - * description: A component that displays a short string and an icon. - * * @author Hans Muller * @since 1.2 */ +@JavaBean(defaultProperty = "UI", description = "A component that displays a short string and an icon.") +@SwingContainer(false) @SuppressWarnings("serial") public class JLabel extends JComponent implements SwingConstants, Accessible { @@ -256,12 +249,9 @@ public class JLabel extends JComponent implements SwingConstants, Accessible * * @param ui the LabelUI L&F object * @see UIDefaults#getUI - * @beaninfo - * bound: true - * hidden: true - * attribute: visualUpdate true - * description: The UI object that implements the Component's LookAndFeel. */ + @BeanProperty(hidden = true, visualUpdate = true, description + = "The UI object that implements the Component's LookAndFeel.") public void setUI(LabelUI ui) { super.setUI(ui); // disabled icon is generated by LF so it should be unset here @@ -277,7 +267,7 @@ public class JLabel extends JComponent implements SwingConstants, Accessible * @see JComponent#updateUI */ public void updateUI() { - setUI((LabelUI)UIManager.getUI(this)); + setUI((LabelUI) UIManager.getUI(this)); } @@ -290,6 +280,7 @@ public class JLabel extends JComponent implements SwingConstants, Accessible * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; } @@ -318,12 +309,9 @@ public class JLabel extends JComponent implements SwingConstants, Accessible * @see #setVerticalTextPosition * @see #setHorizontalTextPosition * @see #setIcon - * @beaninfo - * preferred: true - * bound: true - * attribute: visualUpdate true - * description: Defines the single line of text this component will display. */ + @BeanProperty(preferred = true, visualUpdate = true, description + = "Defines the single line of text this component will display.") public void setText(String text) { String oldAccessibleName = null; @@ -375,12 +363,9 @@ public class JLabel extends JComponent implements SwingConstants, Accessible * @see #setVerticalTextPosition * @see #setHorizontalTextPosition * @see #getIcon - * @beaninfo - * preferred: true - * bound: true - * attribute: visualUpdate true - * description: The icon this component will display. */ + @BeanProperty(preferred = true, visualUpdate = true, description + = "The icon this component will display.") public void setIcon(Icon icon) { Icon oldValue = defaultIcon; defaultIcon = icon; @@ -452,11 +437,9 @@ public class JLabel extends JComponent implements SwingConstants, Accessible * @param disabledIcon the Icon to display when the component is disabled * @see #getDisabledIcon * @see #setEnabled - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: The icon to display if the label is disabled. */ + @BeanProperty(visualUpdate = true, description + = "The icon to display if the label is disabled.") public void setDisabledIcon(Icon disabledIcon) { Icon oldValue = this.disabledIcon; this.disabledIcon = disabledIcon; @@ -485,11 +468,9 @@ public class JLabel extends JComponent implements SwingConstants, Accessible * @param key a keycode that indicates a mnemonic key * @see #getLabelFor * @see #setLabelFor - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: The mnemonic keycode. */ + @BeanProperty(visualUpdate = true, description + = "The mnemonic keycode.") public void setDisplayedMnemonic(int key) { int oldKey = mnemonic; mnemonic = key; @@ -555,13 +536,9 @@ public class JLabel extends JComponent implements SwingConstants, Accessible * @param index Index into the String to underline * @exception IllegalArgumentException will be thrown if index * is >= length of the text, or < -1 - * - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: the index into the String to draw the keyboard character - * mnemonic at */ + @BeanProperty(visualUpdate = true, description + = "the index into the String to draw the keyboard character mnemonic at") public void setDisplayedMnemonicIndex(int index) throws IllegalArgumentException { int oldValue = mnemonicIndex; @@ -665,12 +642,9 @@ public class JLabel extends JComponent implements SwingConstants, Accessible * * @param iconTextGap the space between the icon and text properties * @see #getIconTextGap - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: If both the icon and text properties are set, this - * property defines the space between them. */ + @BeanProperty(visualUpdate = true, description + = "If both the icon and text properties are set, this property defines the space between them.") public void setIconTextGap(int iconTextGap) { int oldValue = this.iconTextGap; this.iconTextGap = iconTextGap; @@ -713,14 +687,12 @@ public class JLabel extends JComponent implements SwingConstants, Accessible * * @see SwingConstants * @see #getVerticalAlignment - * @beaninfo - * bound: true - * enum: TOP SwingConstants.TOP - * CENTER SwingConstants.CENTER - * BOTTOM SwingConstants.BOTTOM - * attribute: visualUpdate true - * description: The alignment of the label's contents along the Y axis. */ + @BeanProperty(visualUpdate = true, enumerationValues = { + "SwingConstants.TOP", + "SwingConstants.CENTER", + "SwingConstants.BOTTOM"}, + description = "The alignment of the label's contents along the Y axis.") public void setVerticalAlignment(int alignment) { if (alignment == verticalAlignment) return; int oldValue = verticalAlignment; @@ -763,16 +735,14 @@ public class JLabel extends JComponent implements SwingConstants, Accessible * * @see SwingConstants * @see #getHorizontalAlignment - * @beaninfo - * bound: true - * enum: LEFT SwingConstants.LEFT - * CENTER SwingConstants.CENTER - * RIGHT SwingConstants.RIGHT - * LEADING SwingConstants.LEADING - * TRAILING SwingConstants.TRAILING - * attribute: visualUpdate true - * description: The alignment of the label's content along the X axis. */ + @BeanProperty(visualUpdate = true, enumerationValues = { + "SwingConstants.LEFT", + "SwingConstants.CENTER", + "SwingConstants.RIGHT", + "SwingConstants.LEADING", + "SwingConstants.TRAILING"}, description + = "The alignment of the label's content along the X axis.") public void setHorizontalAlignment(int alignment) { if (alignment == horizontalAlignment) return; int oldValue = horizontalAlignment; @@ -818,15 +788,12 @@ public class JLabel extends JComponent implements SwingConstants, Accessible * * @see SwingConstants * @see #getVerticalTextPosition - * @beaninfo - * bound: true - * enum: TOP SwingConstants.TOP - * CENTER SwingConstants.CENTER - * BOTTOM SwingConstants.BOTTOM - * expert: true - * attribute: visualUpdate true - * description: The vertical position of the text relative to it's image. */ + @BeanProperty(expert = true, visualUpdate = true, enumerationValues = { + "SwingConstants.TOP", + "SwingConstants.CENTER", + "SwingConstants.BOTTOM"}, + description = "The vertical position of the text relative to it's image.") public void setVerticalTextPosition(int textPosition) { if (textPosition == verticalTextPosition) return; int old = verticalTextPosition; @@ -870,18 +837,14 @@ public class JLabel extends JComponent implements SwingConstants, Accessible * TRAILING (the default). * * @see SwingConstants - * @beaninfo - * expert: true - * bound: true - * enum: LEFT SwingConstants.LEFT - * CENTER SwingConstants.CENTER - * RIGHT SwingConstants.RIGHT - * LEADING SwingConstants.LEADING - * TRAILING SwingConstants.TRAILING - * attribute: visualUpdate true - * description: The horizontal position of the label's text, - * relative to its image. */ + @BeanProperty(expert = true, visualUpdate = true, enumerationValues = { + "SwingConstants.LEFT", + "SwingConstants.CENTER", + "SwingConstants.RIGHT", + "SwingConstants.LEADING", + "SwingConstants.TRAILING"}, description + = "The horizontal position of the label's text, relative to its image.") public void setHorizontalTextPosition(int textPosition) { int old = horizontalTextPosition; this.horizontalTextPosition = checkHorizontalKey(textPosition, @@ -1035,11 +998,9 @@ public class JLabel extends JComponent implements SwingConstants, Accessible * * @see #getDisplayedMnemonic * @see #setDisplayedMnemonic - * - * @beaninfo - * bound: true - * description: The component this is labelling. */ + @BeanProperty(description + = "The component this is labelling.") public void setLabelFor(Component c) { Component oldC = labelFor; labelFor = c; @@ -1057,10 +1018,9 @@ public class JLabel extends JComponent implements SwingConstants, Accessible * Get the AccessibleContext of this object * * @return the AccessibleContext of this object - * @beaninfo - * expert: true - * description: The AccessibleContext associated with this Label. */ + @BeanProperty(bound = false, expert = true, description + = "The AccessibleContext associated with this Label.") public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJLabel(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JLayeredPane.java b/jdk/src/java.desktop/share/classes/javax/swing/JLayeredPane.java index ce5998f8f56..3d561b99bef 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JLayeredPane.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JLayeredPane.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,9 @@ import java.util.Hashtable; import java.awt.Color; import java.awt.Graphics; import java.awt.Rectangle; +import java.beans.JavaBean; +import java.beans.BeanProperty; + import sun.awt.SunToolkit; import javax.accessibility.*; @@ -155,6 +158,7 @@ import javax.accessibility.*; * @author David Kloba * @since 1.2 */ +@JavaBean(defaultProperty = "accessibleContext") @SuppressWarnings("serial") public class JLayeredPane extends JComponent implements Accessible { /// Watch the values in getObjectForLayer() @@ -275,6 +279,7 @@ public class JLayeredPane extends JComponent implements Accessible { * @return false if components can overlap, else true * @see JComponent#isOptimizedDrawingEnabled */ + @BeanProperty(bound = false) public boolean isOptimizedDrawingEnabled() { return optimizedDrawingPossible; } @@ -738,6 +743,7 @@ public class JLayeredPane extends JComponent implements Accessible { * @return an AccessibleJLayeredPane that serves as the * AccessibleContext of this JLayeredPane */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJLayeredPane(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JList.java b/jdk/src/java.desktop/share/classes/javax/swing/JList.java index 14379bd5668..0b5986e7b09 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JList.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JList.java @@ -22,7 +22,6 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ - package javax.swing; import java.awt.*; @@ -34,6 +33,8 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.beans.JavaBean; +import java.beans.BeanProperty; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.beans.Transient; @@ -44,7 +45,6 @@ import javax.swing.plaf.*; import javax.swing.text.Position; import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; import java.io.IOException; import java.io.Serializable; @@ -52,7 +52,6 @@ import sun.swing.SwingUtilities2; import sun.swing.SwingUtilities2.Section; import static sun.swing.SwingUtilities2.Section.*; - /** * A component that displays a list of objects and allows the user to select * one or more items. A separate model, {@code ListModel}, maintains the @@ -271,13 +270,11 @@ import static sun.swing.SwingUtilities2.Section.*; * * @param the type of the elements of this list * - * @beaninfo - * attribute: isContainer false - * description: A component which allows for the selection of one or more objects from a list. - * * @author Hans Muller * @since 1.2 */ +@JavaBean(defaultProperty = "UI", description = "A component which allows for the selection of one or more objects from a list.") +@SwingContainer(false) @SuppressWarnings("serial") // Same-version serialization only public class JList extends JComponent implements Scrollable, Accessible { @@ -515,12 +512,9 @@ public class JList extends JComponent implements Scrollable, Accessible * * @param ui the ListUI object * @see UIDefaults#getUI - * @beaninfo - * bound: true - * hidden: true - * attribute: visualUpdate true - * description: The UI object that implements the Component's LookAndFeel. */ + @BeanProperty(hidden = true, visualUpdate = true, description + = "The UI object that implements the Component's LookAndFeel.") public void setUI(ListUI ui) { super.setUI(ui); } @@ -555,6 +549,7 @@ public class JList extends JComponent implements Scrollable, Accessible * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; } @@ -640,11 +635,9 @@ public class JList extends JComponent implements Scrollable, Accessible * @see #setFixedCellWidth * @see #setFixedCellHeight * @see JComponent#addPropertyChangeListener - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: The cell prototype value, used to compute cell width and height. */ + @BeanProperty(visualUpdate = true, description + = "The cell prototype value, used to compute cell width and height.") public void setPrototypeCellValue(E prototypeCellValue) { E oldValue = this.prototypeCellValue; this.prototypeCellValue = prototypeCellValue; @@ -685,11 +678,9 @@ public class JList extends JComponent implements Scrollable, Accessible * @see #setPrototypeCellValue * @see #setFixedCellWidth * @see JComponent#addPropertyChangeListener - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: Defines a fixed cell width when greater than zero. */ + @BeanProperty(visualUpdate = true, description + = "Defines a fixed cell width when greater than zero.") public void setFixedCellWidth(int width) { int oldValue = fixedCellWidth; fixedCellWidth = width; @@ -721,11 +712,9 @@ public class JList extends JComponent implements Scrollable, Accessible * @see #setPrototypeCellValue * @see #setFixedCellWidth * @see JComponent#addPropertyChangeListener - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: Defines a fixed cell height when greater than zero. */ + @BeanProperty(visualUpdate = true, description + = "Defines a fixed cell height when greater than zero.") public void setFixedCellHeight(int height) { int oldValue = fixedCellHeight; fixedCellHeight = height; @@ -763,11 +752,9 @@ public class JList extends JComponent implements Scrollable, Accessible * @param cellRenderer the ListCellRenderer * that paints list cells * @see #getCellRenderer - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: The component used to draw the cells. */ + @BeanProperty(visualUpdate = true, description + = "The component used to draw the cells.") public void setCellRenderer(ListCellRenderer cellRenderer) { ListCellRenderer oldValue = this.cellRenderer; this.cellRenderer = cellRenderer; @@ -818,11 +805,9 @@ public class JList extends JComponent implements Scrollable, Accessible * @see #setBackground * @see #setFont * @see DefaultListCellRenderer - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: The foreground color of selected cells. */ + @BeanProperty(visualUpdate = true, description + = "The foreground color of selected cells.") public void setSelectionForeground(Color selectionForeground) { Color oldValue = this.selectionForeground; this.selectionForeground = selectionForeground; @@ -865,11 +850,9 @@ public class JList extends JComponent implements Scrollable, Accessible * @see #setBackground * @see #setFont * @see DefaultListCellRenderer - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: The background color of selected cells. */ + @BeanProperty(visualUpdate = true, description + = "The background color of selected cells.") public void setSelectionBackground(Color selectionBackground) { Color oldValue = this.selectionBackground; this.selectionBackground = selectionBackground; @@ -920,12 +903,9 @@ public class JList extends JComponent implements Scrollable, Accessible * @see #setLayoutOrientation * @see JComponent#getVisibleRect * @see JViewport - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: The preferred number of rows to display without - * requiring scrolling */ + @BeanProperty(visualUpdate = true, description + = "The preferred number of rows to display without requiring scrolling") public void setVisibleRowCount(int visibleRowCount) { int oldValue = this.visibleRowCount; this.visibleRowCount = Math.max(0, visibleRowCount); @@ -999,14 +979,12 @@ public class JList extends JComponent implements Scrollable, Accessible * @throws IllegalArgumentException if {@code layoutOrientation} isn't one of the * allowable values * @since 1.4 - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: Defines the way list cells are layed out. - * enum: VERTICAL JList.VERTICAL - * HORIZONTAL_WRAP JList.HORIZONTAL_WRAP - * VERTICAL_WRAP JList.VERTICAL_WRAP */ + @BeanProperty(visualUpdate = true, enumerationValues = { + "JList.VERTICAL", + "JList.HORIZONTAL_WRAP", + "JList.VERTICAL_WRAP"}, description + = "Defines the way list cells are layed out.") public void setLayoutOrientation(int layoutOrientation) { int oldValue = this.layoutOrientation; switch (layoutOrientation) { @@ -1034,6 +1012,7 @@ public class JList extends JComponent implements Scrollable, Accessible * @see #getLastVisibleIndex * @see JComponent#getVisibleRect */ + @BeanProperty(bound = false) public int getFirstVisibleIndex() { Rectangle r = getVisibleRect(); int first; @@ -1064,6 +1043,7 @@ public class JList extends JComponent implements Scrollable, Accessible * @see #getFirstVisibleIndex * @see JComponent#getVisibleRect */ + @BeanProperty(bound = false) public int getLastVisibleIndex() { boolean leftToRight = this.getComponentOrientation().isLeftToRight(); Rectangle r = getVisibleRect(); @@ -1180,11 +1160,9 @@ public class JList extends JComponent implements Scrollable, Accessible * @see #setTransferHandler * @see TransferHandler * @since 1.4 - * - * @beaninfo - * description: determines whether automatic drag handling is enabled - * bound: false */ + @BeanProperty(bound = false, description + = "determines whether automatic drag handling is enabled") public void setDragEnabled(boolean b) { if (b && GraphicsEnvironment.isHeadless()) { throw new HeadlessException(); @@ -1449,6 +1427,7 @@ public class JList extends JComponent implements Scrollable, Accessible * @see TransferHandler#canImport(TransferHandler.TransferSupport) * @since 1.6 */ + @BeanProperty(bound = false) public final DropLocation getDropLocation() { return dropLocation; } @@ -1664,11 +1643,9 @@ public class JList extends JComponent implements Scrollable, Accessible * null * @see #getModel * @see #clearSelection - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: The object that contains the data to be drawn by this JList. */ + @BeanProperty(visualUpdate = true, description + = "The object that contains the data to be drawn by this JList.") public void setModel(ListModel model) { if (model == null) { throw new IllegalArgumentException("model must be non null"); @@ -1860,6 +1837,7 @@ public class JList extends JComponent implements Scrollable, Accessible * @see #addListSelectionListener * @since 1.4 */ + @BeanProperty(bound = false) public ListSelectionListener[] getListSelectionListeners() { return listenerList.getListeners(ListSelectionListener.class); } @@ -1879,10 +1857,9 @@ public class JList extends JComponent implements Scrollable, Accessible * @exception IllegalArgumentException if selectionModel * is null * @see #getSelectionModel - * @beaninfo - * bound: true - * description: The selection model, recording which cells are selected. */ + @BeanProperty(description + = "The selection model, recording which cells are selected.") public void setSelectionModel(ListSelectionModel selectionModel) { if (selectionModel == null) { throw new IllegalArgumentException("selectionModel must be non null"); @@ -1928,12 +1905,12 @@ public class JList extends JComponent implements Scrollable, Accessible * @see #getSelectionMode * @throws IllegalArgumentException if the selection mode isn't * one of those allowed - * @beaninfo - * description: The selection mode. - * enum: SINGLE_SELECTION ListSelectionModel.SINGLE_SELECTION - * SINGLE_INTERVAL_SELECTION ListSelectionModel.SINGLE_INTERVAL_SELECTION - * MULTIPLE_INTERVAL_SELECTION ListSelectionModel.MULTIPLE_INTERVAL_SELECTION */ + @BeanProperty(bound = false, enumerationValues = { + "ListSelectionModel.SINGLE_SELECTION", + "ListSelectionModel.SINGLE_INTERVAL_SELECTION", + "ListSelectionModel.MULTIPLE_INTERVAL_SELECTION"}, description + = "The selection mode.") public void setSelectionMode(int selectionMode) { getSelectionModel().setSelectionMode(selectionMode); } @@ -1958,6 +1935,7 @@ public class JList extends JComponent implements Scrollable, Accessible * @return the anchor selection index * @see ListSelectionModel#getAnchorSelectionIndex */ + @BeanProperty(bound = false) public int getAnchorSelectionIndex() { return getSelectionModel().getAnchorSelectionIndex(); } @@ -1969,9 +1947,9 @@ public class JList extends JComponent implements Scrollable, Accessible * * @return the lead selection index * @see ListSelectionModel#getLeadSelectionIndex - * @beaninfo - * description: The lead selection index. */ + @BeanProperty(bound = false, description + = "The lead selection index.") public int getLeadSelectionIndex() { return getSelectionModel().getLeadSelectionIndex(); } @@ -1985,6 +1963,7 @@ public class JList extends JComponent implements Scrollable, Accessible * @return the smallest selected cell index, or {@code -1} * @see ListSelectionModel#getMinSelectionIndex */ + @BeanProperty(bound = false) public int getMinSelectionIndex() { return getSelectionModel().getMinSelectionIndex(); } @@ -1998,6 +1977,7 @@ public class JList extends JComponent implements Scrollable, Accessible * @return the largest selected cell index * @see ListSelectionModel#getMaxSelectionIndex */ + @BeanProperty(bound = false) public int getMaxSelectionIndex() { return getSelectionModel().getMaxSelectionIndex(); } @@ -2028,6 +2008,7 @@ public class JList extends JComponent implements Scrollable, Accessible * @see ListSelectionModel#isSelectionEmpty * @see #clearSelection */ + @BeanProperty(bound = false) public boolean isSelectionEmpty() { return getSelectionModel().isSelectionEmpty(); } @@ -2202,9 +2183,9 @@ public class JList extends JComponent implements Scrollable, Accessible * @see ListSelectionModel#setSelectionInterval * @see #isSelectedIndex * @see #addListSelectionListener - * @beaninfo - * description: The index of the selected cell. */ + @BeanProperty(bound = false, description + = "The index of the selected cell.") public void setSelectedIndex(int index) { if (index >= getModel().getSize()) { return; @@ -2252,6 +2233,7 @@ public class JList extends JComponent implements Scrollable, Accessible * @deprecated As of JDK 1.7, replaced by {@link #getSelectedValuesList()} */ @Deprecated + @BeanProperty(bound = false) public Object[] getSelectedValues() { ListSelectionModel sm = getSelectionModel(); ListModel dm = getModel(); @@ -2286,6 +2268,7 @@ public class JList extends JComponent implements Scrollable, Accessible * * @since 1.7 */ + @BeanProperty(bound = false) public List getSelectedValuesList() { ListSelectionModel sm = getSelectionModel(); ListModel dm = getModel(); @@ -2338,6 +2321,7 @@ public class JList extends JComponent implements Scrollable, Accessible * @see #getModel * @see #addListSelectionListener */ + @BeanProperty(bound = false) public E getSelectedValue() { int i = getMinSelectionIndex(); return (i == -1) ? null : getModel().getElementAt(i); @@ -2427,6 +2411,7 @@ public class JList extends JComponent implements Scrollable, Accessible * @see #getPreferredScrollableViewportSize * @see #setPrototypeCellValue */ + @BeanProperty(bound = false) public Dimension getPreferredScrollableViewportSize() { if (getLayoutOrientation() != VERTICAL) { @@ -2764,6 +2749,7 @@ public class JList extends JComponent implements Scrollable, Accessible * width to match its own * @see Scrollable#getScrollableTracksViewportWidth */ + @BeanProperty(bound = false) public boolean getScrollableTracksViewportWidth() { if (getLayoutOrientation() == HORIZONTAL_WRAP && getVisibleRowCount() <= 0) { @@ -2790,6 +2776,7 @@ public class JList extends JComponent implements Scrollable, Accessible * height to match its own * @see Scrollable#getScrollableTracksViewportHeight */ + @BeanProperty(bound = false) public boolean getScrollableTracksViewportHeight() { if (getLayoutOrientation() == VERTICAL_WRAP && getVisibleRowCount() <= 0) { @@ -2861,6 +2848,7 @@ public class JList extends JComponent implements Scrollable, Accessible * @return an {@code AccessibleJList} that serves as the * {@code AccessibleContext} of this {@code JList} */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJList(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JMenu.java b/jdk/src/java.desktop/share/classes/javax/swing/JMenu.java index 47834d02d58..c9a279a5ed0 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JMenu.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JMenu.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,41 +22,34 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ - package javax.swing; -import java.awt.AWTEvent; import java.awt.Component; import java.awt.ComponentOrientation; import java.awt.Container; import java.awt.Dimension; -import java.awt.Frame; -import java.awt.Graphics; import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.Insets; import java.awt.Point; -import java.awt.Polygon; import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.event.*; -import java.beans.*; +import java.beans.JavaBean; +import java.beans.BeanProperty; +import java.beans.PropertyChangeListener; import java.util.*; import java.io.Serializable; import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; import java.io.IOException; import javax.swing.event.*; import javax.swing.plaf.*; -import javax.swing.plaf.basic.*; import javax.accessibility.*; -import java.lang.ref.WeakReference; - /** * An implementation of a menu -- a popup window containing * JMenuItems that @@ -97,10 +90,6 @@ import java.lang.ref.WeakReference; * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. * - * @beaninfo - * attribute: isContainer true - * description: A popup window containing menu items displayed in a menu bar. - * * @author Georges Saab * @author David Karlton * @author Arnaud Weber @@ -110,6 +99,8 @@ import java.lang.ref.WeakReference; * @see JPopupMenu * @since 1.2 */ +@JavaBean(description = "A popup window containing menu items displayed in a menu bar.") +@SwingContainer @SuppressWarnings("serial") public class JMenu extends JMenuItem implements Accessible,MenuElement { @@ -232,6 +223,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; } @@ -247,11 +239,6 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * * @param newModel the ButtonModel * @see #getModel - * @beaninfo - * description: The menu's model - * bound: true - * expert: true - * hidden: true */ public void setModel(ButtonModel newModel) { ButtonModel oldModel = getModel(); @@ -285,11 +272,9 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * * @param b true to select (highlight) the menu; false to de-select * the menu - * @beaninfo - * description: When the menu is selected, its popup child is shown. - * expert: true - * hidden: true */ + @BeanProperty(expert = true, hidden = true, description + = "When the menu is selected, its popup child is shown.") public void setSelected(boolean b) { ButtonModel model = getModel(); boolean oldValue = model.isSelected(); @@ -323,11 +308,9 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * * @param b a boolean value -- true to make the menu visible, * false to hide it - * @beaninfo - * description: The popup menu's visibility - * expert: true - * hidden: true */ + @BeanProperty(bound = false, expert = true, hidden = true, description + = "The popup menu's visibility") public void setPopupMenuVisible(boolean b) { if (DEBUG) { System.out.println("in JMenu.setPopupMenuVisible " + b); @@ -517,10 +500,9 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * @param d the number of milliseconds to delay * @exception IllegalArgumentException if d * is less than 0 - * @beaninfo - * description: The delay between menu selection and making the popup menu visible - * expert: true */ + @BeanProperty(bound = false, expert = true, description + = "The delay between menu selection and making the popup menu visible") public void setDelay(int d) { if (d < 0) throw new IllegalArgumentException("Delay must be a positive integer"); @@ -788,6 +770,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * @return an integer equal to the number of items on the menu * @see #getMenuComponentCount */ + @BeanProperty(bound = false) public int getItemCount() { return getMenuComponentCount(); } @@ -799,6 +782,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * @return true if the menu can be torn off, else false * @exception Error if invoked -- this method is not yet implemented */ + @BeanProperty(bound = false) public boolean isTearOff() { throw new Error("boolean isTearOff() {} not yet implemented"); } @@ -856,6 +840,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * * @return an integer containing the number of components on the menu */ + @BeanProperty(bound = false) public int getMenuComponentCount() { int componentCount = 0; if (popupMenu != null) @@ -886,6 +871,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * @return an array of Components or an empty array * if there is no popup menu */ + @BeanProperty(bound = false) public Component[] getMenuComponents() { if (popupMenu != null) return popupMenu.getComponents(); @@ -901,6 +887,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * false if the menu is activated from a menu item * on another menu */ + @BeanProperty(bound = false) public boolean isTopLevelMenu() { return getParent() instanceof JMenuBar; @@ -985,6 +972,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * * @return the {@code JPopupMenu} associated with this menu */ + @BeanProperty(bound = false) public JPopupMenu getPopupMenu() { ensurePopupMenuCreated(); return popupMenu; @@ -1016,6 +1004,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * array if no listeners have been added * @since 1.4 */ + @BeanProperty(bound = false) public MenuListener[] getMenuListeners() { return listenerList.getListeners(MenuListener.class); } @@ -1208,6 +1197,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * * @return an array of MenuElement objects */ + @BeanProperty(bound = false) public MenuElement[] getSubElements() { if(popupMenu == null) return new MenuElement[0]; @@ -1270,11 +1260,6 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * without navigating the menu hierarchy * @exception Error if invoked -- this method is not defined for JMenu. * Use setMnemonic instead - * - * @beaninfo - * description: The keystroke combination which will invoke the JMenuItem's - * actionlisteners without navigating the menu hierarchy - * hidden: true */ public void setAccelerator(KeyStroke keyStroke) { throw new Error("setAccelerator() is not defined for JMenu. Use setMnemonic() instead."); @@ -1381,6 +1366,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement * @return an AccessibleJMenu that serves as the * AccessibleContext of this JMenu */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJMenu(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JMenuBar.java b/jdk/src/java.desktop/share/classes/javax/swing/JMenuBar.java index c8fcb6673c6..979d2b8a3d7 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JMenuBar.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JMenuBar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,27 +22,22 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ - package javax.swing; import java.awt.Component; -import java.awt.Dimension; import java.awt.Graphics; import java.awt.Insets; -import java.awt.Point; -import java.awt.Rectangle; import java.awt.event.*; +import java.beans.JavaBean; +import java.beans.BeanProperty; import java.beans.Transient; import java.util.Vector; -import java.util.Enumeration; import java.io.Serializable; import java.io.ObjectOutputStream; import java.io.ObjectInputStream; import java.io.IOException; -import javax.swing.event.*; -import javax.swing.border.Border; import javax.swing.plaf.*; import javax.accessibility.*; @@ -78,9 +73,6 @@ import javax.accessibility.*; * of JMenuBar is set to false. To resolve this, * you should call the JMenuBar.setFocusTraversalKeysEnabled(true) * method. - * @beaninfo - * attribute: isContainer true - * description: A container for holding and displaying menus. * * @author Georges Saab * @author David Karlton @@ -90,6 +82,8 @@ import javax.accessibility.*; * @see JMenuItem * @since 1.2 */ +@JavaBean(defaultProperty = "UI", description = "A container for holding and displaying menus.") +@SwingContainer @SuppressWarnings("serial") public class JMenuBar extends JComponent implements Accessible,MenuElement { @@ -137,12 +131,9 @@ public class JMenuBar extends JComponent implements Accessible,MenuElement * * @param ui the new MenuBarUI L&F object * @see UIDefaults#getUI - * @beaninfo - * bound: true - * hidden: true - * attribute: visualUpdate true - * description: The UI object that implements the Component's LookAndFeel. */ + @BeanProperty(hidden = true, visualUpdate = true, description + = "The UI object that implements the Component's LookAndFeel.") public void setUI(MenuBarUI ui) { super.setUI(ui); } @@ -164,6 +155,7 @@ public class JMenuBar extends JComponent implements Accessible,MenuElement * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; } @@ -184,10 +176,8 @@ public class JMenuBar extends JComponent implements Accessible,MenuElement * * @param model the SingleSelectionModel to use * @see SingleSelectionModel - * @beaninfo - * bound: true - * description: The selection model, recording which child is selected. */ + @BeanProperty(description = "The selection model, recording which child is selected.") public void setSelectionModel(SingleSelectionModel model) { SingleSelectionModel oldValue = selectionModel; this.selectionModel = model; @@ -227,6 +217,7 @@ public class JMenuBar extends JComponent implements Accessible,MenuElement * * @return the number of items in the menu bar */ + @BeanProperty(bound = false) public int getMenuCount() { return getComponentCount(); } @@ -304,6 +295,7 @@ public class JMenuBar extends JComponent implements Accessible,MenuElement * * @return true if a selection has been made, else false */ + @BeanProperty(bound = false) public boolean isSelected() { return selectionModel.isSelected(); } @@ -323,11 +315,9 @@ public class JMenuBar extends JComponent implements Accessible,MenuElement * @param b if true and border property is not null, * the border is painted. * @see #isBorderPainted - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: Whether the border should be painted. */ + @BeanProperty(visualUpdate = true, description + = "Whether the border should be painted.") public void setBorderPainted(boolean b) { boolean oldValue = paintBorder; paintBorder = b; @@ -359,11 +349,9 @@ public class JMenuBar extends JComponent implements Accessible,MenuElement * * @param m an Insets object containing the margin values * @see Insets - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: The space between the menubar's border and its contents */ + @BeanProperty(visualUpdate = true, description + = "The space between the menubar's border and its contents") public void setMargin(Insets m) { Insets old = margin; this.margin = m; @@ -423,6 +411,7 @@ public class JMenuBar extends JComponent implements Accessible,MenuElement * other menu elements. * @return an array of menu items in the menu bar. */ + @BeanProperty(bound = false) public MenuElement[] getSubElements() { MenuElement result[]; Vector tmp = new Vector(); @@ -487,6 +476,7 @@ public class JMenuBar extends JComponent implements Accessible,MenuElement * @return an AccessibleJMenuBar that serves as the * AccessibleContext of this JMenuBar */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJMenuBar(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JMenuItem.java b/jdk/src/java.desktop/share/classes/javax/swing/JMenuItem.java index 7af01881951..cf80c9827a9 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JMenuItem.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JMenuItem.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,13 +24,11 @@ */ package javax.swing; -import java.util.EventListener; import java.awt.*; import java.awt.event.*; -import java.awt.image.*; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; +import java.beans.JavaBean; +import java.beans.BeanProperty; import java.io.Serializable; import java.io.ObjectOutputStream; @@ -38,7 +36,6 @@ import java.io.ObjectInputStream; import java.io.IOException; import javax.swing.plaf.*; -import javax.swing.plaf.basic.*; import javax.swing.event.*; import javax.accessibility.*; @@ -76,10 +73,6 @@ import javax.accessibility.*; * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. * - * @beaninfo - * attribute: isContainer false - * description: An item which can be selected in a menu. - * * @author Georges Saab * @author David Karlton * @see JPopupMenu @@ -88,6 +81,8 @@ import javax.accessibility.*; * @see JRadioButtonMenuItem * @since 1.2 */ +@JavaBean(defaultProperty = "UIClassID", description = "An item which can be selected in a menu.") +@SwingContainer(false) @SuppressWarnings("serial") public class JMenuItem extends AbstractButton implements Accessible,MenuElement { @@ -232,12 +227,9 @@ public class JMenuItem extends AbstractButton implements Accessible,MenuElement * * @param ui the JMenuItemUI L&F object * @see UIDefaults#getUI - * @beaninfo - * bound: true - * hidden: true - * attribute: visualUpdate true - * description: The UI object that implements the Component's LookAndFeel. */ + @BeanProperty(hidden = true, visualUpdate = true, description + = "The UI object that implements the LookAndFeel.") public void setUI(MenuItemUI ui) { super.setUI(ui); } @@ -260,6 +252,7 @@ public class JMenuItem extends AbstractButton implements Accessible,MenuElement * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; } @@ -272,10 +265,9 @@ public class JMenuItem extends AbstractButton implements Accessible,MenuElement * event will not fire and the menu item will be disarmed. * * @param b true to arm the menu item so it can be selected - * @beaninfo - * description: Mouse release will fire an action event - * hidden: true */ + @BeanProperty(bound = false, hidden = true, description + = "Mouse release will fire an action event") public void setArmed(boolean b) { ButtonModel model = getModel(); @@ -300,11 +292,9 @@ public class JMenuItem extends AbstractButton implements Accessible,MenuElement * Enables or disables the menu item. * * @param b true to enable the item - * @beaninfo - * description: Does the component react to user interaction - * bound: true - * preferred: true */ + @BeanProperty(preferred = true, description + = "The enabled state of the component.") public void setEnabled(boolean b) { // Make sure we aren't armed! if (!b && !UIManager.getBoolean("MenuItem.disabledAreNavigable")) { @@ -344,13 +334,9 @@ public class JMenuItem extends AbstractButton implements Accessible,MenuElement * * @param keyStroke the KeyStroke which will * serve as an accelerator - * @beaninfo - * description: The keystroke combination which will invoke the - * JMenuItem's actionlisteners without navigating the - * menu hierarchy - * bound: true - * preferred: true */ + @BeanProperty(preferred = true, description + = "The keystroke combination which will invoke the JMenuItem's actionlisteners without navigating the menu hierarchy") public void setAccelerator(KeyStroke keyStroke) { KeyStroke oldAccelerator = accelerator; this.accelerator = keyStroke; @@ -681,6 +667,7 @@ public class JMenuItem extends AbstractButton implements Accessible,MenuElement * * @return an array of MenuElements */ + @BeanProperty(bound = false) public MenuElement[] getSubElements() { return new MenuElement[0]; } @@ -722,6 +709,7 @@ public class JMenuItem extends AbstractButton implements Accessible,MenuElement * array if no listeners have been added * @since 1.4 */ + @BeanProperty(bound = false) public MenuDragMouseListener[] getMenuDragMouseListeners() { return listenerList.getListeners(MenuDragMouseListener.class); } @@ -752,6 +740,7 @@ public class JMenuItem extends AbstractButton implements Accessible,MenuElement * array if no listeners have been added * @since 1.4 */ + @BeanProperty(bound = false) public MenuKeyListener[] getMenuKeyListeners() { return listenerList.getListeners(MenuKeyListener.class); } @@ -808,6 +797,7 @@ public class JMenuItem extends AbstractButton implements Accessible,MenuElement * @return an AccessibleJMenuItem that serves as the * AccessibleContext of this JMenuItem */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJMenuItem(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JOptionPane.java b/jdk/src/java.desktop/share/classes/javax/swing/JOptionPane.java index 491fddee12f..77eb97e9e03 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JOptionPane.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JOptionPane.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ - package javax.swing; import java.awt.BorderLayout; @@ -35,6 +34,8 @@ import java.awt.Frame; import java.awt.Point; import java.awt.HeadlessException; import java.awt.Window; +import java.beans.JavaBean; +import java.beans.BeanProperty; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.awt.event.WindowListener; @@ -301,14 +302,12 @@ import sun.awt.AWTAccessor; * * @see JInternalFrame * - * @beaninfo - * attribute: isContainer true - * description: A component which implements standard dialog box controls. - * * @author James Gosling * @author Scott Violet * @since 1.2 */ +@JavaBean(defaultProperty = "UI", description = "A component which implements standard dialog box controls.") +@SwingContainer @SuppressWarnings("serial") // Same-version serialization only public class JOptionPane extends JComponent implements Accessible { @@ -1828,11 +1827,9 @@ public class JOptionPane extends JComponent implements Accessible * * @param ui the OptionPaneUI {@literal L&F} object * @see UIDefaults#getUI - * @beaninfo - * bound: true - * hidden: true - * description: The UI object that implements the optionpane's LookAndFeel */ + @BeanProperty(hidden = true, description + = "The UI object that implements the optionpane's LookAndFeel") public void setUI(OptionPaneUI ui) { if (this.ui != ui) { super.setUI(ui); @@ -1869,6 +1866,7 @@ public class JOptionPane extends JComponent implements Accessible * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; } @@ -1878,12 +1876,9 @@ public class JOptionPane extends JComponent implements Accessible * Sets the option pane's message-object. * @param newMessage the Object to display * @see #getMessage - * - * @beaninfo - * preferred: true - * bound: true - * description: The optionpane's message object. */ + @BeanProperty(preferred = true, description + = "The optionpane's message object.") public void setMessage(Object newMessage) { Object oldMessage = message; @@ -1907,11 +1902,9 @@ public class JOptionPane extends JComponent implements Accessible * @param newIcon the Icon to display * * @see #getIcon - * @beaninfo - * preferred: true - * bound: true - * description: The option pane's type icon. */ + @BeanProperty(preferred = true, description + = "The option pane's type icon.") public void setIcon(Icon newIcon) { Object oldIcon = icon; @@ -1934,11 +1927,9 @@ public class JOptionPane extends JComponent implements Accessible * @param newValue the chosen value * * @see #getValue - * @beaninfo - * preferred: true - * bound: true - * description: The option pane's value object. */ + @BeanProperty(preferred = true, description + = "The option pane's value object.") public void setValue(Object newValue) { Object oldValue = value; @@ -1975,10 +1966,9 @@ public class JOptionPane extends JComponent implements Accessible * Components to add to the pane * * @see #getOptions - * @beaninfo - * bound: true - * description: The option pane's options objects. */ + @BeanProperty(description + = "The option pane's options objects.") public void setOptions(Object[] newOptions) { Object[] oldOptions = options; @@ -2012,11 +2002,9 @@ public class JOptionPane extends JComponent implements Accessible * keyboard focus * * @see #getInitialValue - * @beaninfo - * preferred: true - * bound: true - * description: The option pane's initial value object. */ + @BeanProperty(preferred = true, description + = "The option pane's initial value object.") public void setInitialValue(Object newInitialValue) { Object oldIV = initialValue; @@ -2048,11 +2036,9 @@ public class JOptionPane extends JComponent implements Accessible * legal values listed above * @see #getMessageType - * @beaninfo - * preferred: true - * bound: true - * description: The option pane's message type. */ + @BeanProperty(preferred = true, description + = "The option pane's message type.") public void setMessageType(int newType) { checkMessageType(newType); int oldType = messageType; @@ -2097,11 +2083,9 @@ public class JOptionPane extends JComponent implements Accessible * * @see #getOptionType * @see #setOptions - * @beaninfo - * preferred: true - * bound: true - * description: The option pane's option type. */ + @BeanProperty(preferred = true, description + = "The option pane's option type.") public void setOptionType(int newType) { checkOptionType(newType); int oldType = optionType; @@ -2149,10 +2133,9 @@ public class JOptionPane extends JComponent implements Accessible * @see #setWantsInput * @see #setInitialSelectionValue * @see #getSelectionValues - * @beaninfo - * bound: true - * description: The option pane's selection values. */ + @BeanProperty(description + = "The option pane's selection values.") public void setSelectionValues(Object[] newValues) { Object[] oldValues = selectionValues; @@ -2178,10 +2161,9 @@ public class JOptionPane extends JComponent implements Accessible * @param newValue the initially selected value * @see #setSelectionValues * @see #getInitialSelectionValue - * @beaninfo - * bound: true - * description: The option pane's initial selection value object. */ + @BeanProperty(description + = "The option pane's initial selection value object.") public void setInitialSelectionValue(Object newValue) { Object oldValue = initialSelectionValue; @@ -2215,11 +2197,9 @@ public class JOptionPane extends JComponent implements Accessible * @see #setInitialSelectionValue * @see #setWantsInput * @see #getInputValue - * @beaninfo - * preferred: true - * bound: true - * description: The option pane's input value object. */ + @BeanProperty(preferred = true, description + = "The option pane's input value object.") public void setInputValue(Object newValue) { Object oldValue = inputValue; @@ -2251,6 +2231,7 @@ public class JOptionPane extends JComponent implements Accessible * * @return an integer giving the maximum number of characters on a line */ + @BeanProperty(bound = false) public int getMaxCharactersPerLineCount() { return Integer.MAX_VALUE; } @@ -2271,11 +2252,9 @@ public class JOptionPane extends JComponent implements Accessible * is provided to allow the user to input a value. * @see #setSelectionValues * @see #setInputValue - * @beaninfo - * preferred: true - * bound: true - * description: Flag which allows the user to input a value. */ + @BeanProperty(preferred = true, description + = "Flag which allows the user to input a value.") public void setWantsInput(boolean newValue) { boolean oldValue = wantsInput; @@ -2525,10 +2504,9 @@ public class JOptionPane extends JComponent implements Accessible * * @return an AccessibleJOptionPane that serves as the * AccessibleContext of this AccessibleJOptionPane - * @beaninfo - * expert: true - * description: The AccessibleContext associated with this option pane */ + @BeanProperty(bound = false, expert = true, description + = "The AccessibleContext associated with this option pane") public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJOptionPane(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JPanel.java b/jdk/src/java.desktop/share/classes/javax/swing/JPanel.java index 293ca2237df..ac0be8dfe9e 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JPanel.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,13 +25,13 @@ package javax.swing; import java.awt.*; +import java.beans.JavaBean; +import java.beans.BeanProperty; import javax.swing.plaf.*; import javax.accessibility.*; -import java.io.Serializable; import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; import java.io.IOException; @@ -56,13 +56,11 @@ import java.io.IOException; * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. * - * @beaninfo - * description: A generic lightweight container. - * * @author Arnaud Weber * @author Steve Wilson * @since 1.2 */ +@JavaBean(defaultProperty = "UI", description = "A generic lightweight container.") @SuppressWarnings("serial") // Same-version serialization only public class JPanel extends JComponent implements Accessible { @@ -145,12 +143,9 @@ public class JPanel extends JComponent implements Accessible * @param ui the PanelUI L&F object * @see UIDefaults#getUI * @since 1.4 - * @beaninfo - * bound: true - * hidden: true - * attribute: visualUpdate true - * description: The UI object that implements the Component's LookAndFeel. */ + @BeanProperty(hidden = true, visualUpdate = true, description + = "The UI object that implements the Component's LookAndFeel.") public void setUI(PanelUI ui) { super.setUI(ui); } @@ -162,10 +157,9 @@ public class JPanel extends JComponent implements Accessible * @return "PanelUI" * @see JComponent#getUIClassID * @see UIDefaults#getUI - * @beaninfo - * expert: true - * description: A string that specifies the name of the L&F class. */ + @BeanProperty(bound = false, expert = true, description + = "A string that specifies the name of the L&F class.") public String getUIClassID() { return uiClassID; } @@ -213,6 +207,7 @@ public class JPanel extends JComponent implements Accessible * @return an AccessibleJPanel that serves as the * AccessibleContext of this JPanel */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJPanel(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JPasswordField.java b/jdk/src/java.desktop/share/classes/javax/swing/JPasswordField.java index 82b6457e8ec..0094b1adb4c 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JPasswordField.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JPasswordField.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,13 +25,12 @@ package javax.swing; import javax.swing.text.*; -import javax.swing.plaf.*; import javax.accessibility.*; +import java.beans.JavaBean; +import java.beans.BeanProperty; import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; import java.io.IOException; -import java.io.*; import java.util.Arrays; /** @@ -68,13 +67,11 @@ import java.util.Arrays; * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. * - * @beaninfo - * attribute: isContainer false - * description: Allows the editing of a line of text but doesn't show the characters. - * * @author Timothy Prinzing * @since 1.2 */ +@JavaBean(description = "Allows the editing of a line of text but doesn't show the characters.") +@SwingContainer(false) @SuppressWarnings("serial") // Same-version serialization only public class JPasswordField extends JTextField { @@ -151,6 +148,7 @@ public class JPasswordField extends JTextField { * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; } @@ -191,10 +189,9 @@ public class JPasswordField extends JTextField { * @param c the echo character to display * @see #echoCharIsSet * @see #getEchoChar - * @beaninfo - * description: character to display in place of the real characters - * attribute: visualUpdate true */ + @BeanProperty(bound = false, visualUpdate = true, description + = "character to display in place of the real characters") public void setEchoChar(char c) { echoChar = c; echoCharSet = true; @@ -292,6 +289,7 @@ public class JPasswordField extends JTextField { * * @return the text */ + @BeanProperty(bound = false) public char[] getPassword() { Document doc = getDocument(); Segment txt = new Segment(); @@ -383,6 +381,7 @@ public class JPasswordField extends JTextField { * AccessibleContext of this * JPasswordField */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJPasswordField(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JPopupMenu.java b/jdk/src/java.desktop/share/classes/javax/swing/JPopupMenu.java index 0df8c126308..f225b2d44ee 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JPopupMenu.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JPopupMenu.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ - package javax.swing; import java.awt.*; @@ -31,21 +30,18 @@ import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; -import java.beans.*; +import java.beans.JavaBean; +import java.beans.BeanProperty; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; -import java.util.Locale; import java.util.Vector; -import java.util.Hashtable; import javax.accessibility.*; import javax.swing.plaf.PopupMenuUI; -import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicComboPopup; import javax.swing.event.*; import sun.awt.SunToolkit; -import sun.security.util.SecurityConstants; - -import java.applet.Applet; /** * An implementation of a popup menu -- a small window that pops up @@ -75,15 +71,13 @@ import java.applet.Applet; * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. * - * @beaninfo - * attribute: isContainer false - * description: A small window that pops up and displays a series of choices. - * * @author Georges Saab * @author David Karlton * @author Arnaud Weber * @since 1.2 */ +@JavaBean(defaultProperty = "UI", description = "A small window that pops up and displays a series of choices.") +@SwingContainer(false) @SuppressWarnings("serial") public class JPopupMenu extends JComponent implements Accessible,MenuElement { @@ -210,12 +204,9 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { * * @param ui the new PopupMenuUI L&F object * @see UIDefaults#getUI - * @beaninfo - * bound: true - * hidden: true - * attribute: visualUpdate true - * description: The UI object that implements the Component's LookAndFeel. */ + @BeanProperty(hidden = true, visualUpdate = true, description + = "The UI object that implements the Component's LookAndFeel.") public void setUI(PopupMenuUI ui) { super.setUI(ui); } @@ -237,6 +228,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; } @@ -274,10 +266,9 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { * * @param model the new SingleSelectionModel * @see SingleSelectionModel - * @beaninfo - * description: The selection model for the popup menu - * expert: true */ + @BeanProperty(bound = false, expert = true, description + = "The selection model for the popup menu") public void setSelectionModel(SingleSelectionModel model) { selectionModel = model; } @@ -495,12 +486,11 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { * no matter what the value of this property. * * @param aFlag false to disable lightweight popups - * @beaninfo - * description: Determines whether lightweight popups are used when possible - * expert: true * * @see #isLightWeightPopupEnabled */ + @BeanProperty(bound = false, expert = true, description + = "Determines whether lightweight popups are used when possible") public void setLightWeightPopupEnabled(boolean aFlag) { // NOTE: this use to set the flag on a shared JPopupMenu, which meant // this effected ALL JPopupMenus. @@ -534,10 +524,9 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { * @param label a string specifying the label for the popup menu * * @see #setLabel - * @beaninfo - * description: The label for the popup menu. - * bound: true */ + @BeanProperty(description + = "The label for the popup menu.") public void setLabel(String label) { String oldValue = this.label; this.label = label; @@ -637,6 +626,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { * array if no listeners have been added * @since 1.4 */ + @BeanProperty(bound = false) public PopupMenuListener[] getPopupMenuListeners() { return listenerList.getListeners(PopupMenuListener.class); } @@ -669,6 +659,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { * array if no listeners have been added * @since 1.5 */ + @BeanProperty(bound = false) public MenuKeyListener[] getMenuKeyListeners() { return listenerList.getListeners(MenuKeyListener.class); } @@ -753,10 +744,9 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { * * @param b true to make the popup visible, or false to * hide it - * @beaninfo - * bound: true - * description: Makes the popup visible */ + @BeanProperty(description + = "Makes the popup visible") public void setVisible(boolean b) { if (DEBUG) { System.out.println("JPopupMenu.setVisible " + b); @@ -868,9 +858,9 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { * in the screen's coordinate space * @param y the y coordinate of the popup's new position * in the screen's coordinate space - * @beaninfo - * description: The location of the popup menu. */ + @BeanProperty(description + = "The location of the popup menu.") public void setLocation(int x, int y) { int oldX = desiredLocationX; int oldY = desiredLocationY; @@ -908,10 +898,9 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { * * @param invoker the Component in which the popup * menu is displayed - * @beaninfo - * description: The invoking component for the popup menu - * expert: true */ + @BeanProperty(bound = false, expert = true, description + = "The invoking component for the popup menu") public void setInvoker(Component invoker) { Component oldInvoker = this.invoker; this.invoker = invoker; @@ -1024,9 +1013,9 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { * * @param d the Dimension specifying the new size * of this component. - * @beaninfo - * description: The size of the popup menu */ + @BeanProperty(description + = "The size of the popup menu") public void setPopupSize(Dimension d) { Dimension oldSize = getPreferredSize(); @@ -1047,9 +1036,9 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { * * @param width the new width of the Popup in pixels * @param height the new height of the Popup in pixels - * @beaninfo - * description: The size of the popup menu */ + @BeanProperty(description + = "The size of the popup menu") public void setPopupSize(int width, int height) { setPopupSize(new Dimension(width, height)); } @@ -1059,11 +1048,9 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { * in a change to the selection model. * * @param sel the Component to select - * @beaninfo - * description: The selected component on the popup menu - * expert: true - * hidden: true */ + @BeanProperty(expert = true, hidden = true, description + = "The selected component on the popup menu") public void setSelected(Component sel) { SingleSelectionModel model = getSelectionModel(); int index = getComponentIndex(sel); @@ -1085,9 +1072,9 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { * * @param b if true, the border is painted. * @see #isBorderPainted - * @beaninfo - * description: Is the border of the popup menu painted */ + @BeanProperty(bound = false, description + = "Is the border of the popup menu painted") public void setBorderPainted(boolean b) { paintBorder = b; repaint(); @@ -1113,6 +1100,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { * * @return an Insets object containing the margin values. */ + @BeanProperty(bound = false) public Insets getMargin() { if(margin == null) { return new Insets(0,0,0,0); @@ -1198,6 +1186,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { * @return an AccessibleJPopupMenu that serves as the * AccessibleContext of this JPopupMenu */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJPopupMenu(); @@ -1512,6 +1501,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement { * @return an array of MenuElement objects * @see MenuElement#getSubElements */ + @BeanProperty(bound = false) public MenuElement[] getSubElements() { MenuElement result[]; Vector tmp = new Vector(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JProgressBar.java b/jdk/src/java.desktop/share/classes/javax/swing/JProgressBar.java index c823176ca36..3504f2ef16a 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JProgressBar.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JProgressBar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,25 +22,23 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ - package javax.swing; -import java.awt.Color; import java.awt.Graphics; +import java.beans.JavaBean; +import java.beans.BeanProperty; import java.text.Format; import java.text.NumberFormat; import java.io.Serializable; import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; import java.io.IOException; import javax.swing.event.*; import javax.accessibility.*; import javax.swing.plaf.ProgressBarUI; - /** * A component that visually displays the progress of some task. As the task * progresses towards completion, the progress bar displays the @@ -122,14 +120,12 @@ import javax.swing.plaf.ProgressBarUI; * @see javax.swing.BoundedRangeModel * @see javax.swing.SwingWorker * - * @beaninfo - * attribute: isContainer false - * description: A component that displays an integer value. - * * @author Michael C. Albers * @author Kathy Walrath * @since 1.2 */ +@JavaBean(defaultProperty = "UI", description = "A component that displays an integer value.") +@SwingContainer(false) @SuppressWarnings("serial") // Same-version serialization only public class JProgressBar extends JComponent implements SwingConstants, Accessible { @@ -394,13 +390,9 @@ public class JProgressBar extends JComponent implements SwingConstants, Accessib * @exception IllegalArgumentException if newOrientation * is an illegal value * @see #getOrientation - * - * @beaninfo - * preferred: true - * bound: true - * attribute: visualUpdate true - * description: Set the progress bar's orientation. */ + @BeanProperty(preferred = true, visualUpdate = true, description + = "Set the progress bar's orientation.") public void setOrientation(int newOrientation) { if (orientation != newOrientation) { switch (newOrientation) { @@ -453,11 +445,9 @@ public class JProgressBar extends JComponent implements SwingConstants, Accessib * @param b true if the progress bar should render a string * @see #isStringPainted * @see #setString - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: Whether the progress bar should render a string. */ + @BeanProperty(visualUpdate = true, description + = "Whether the progress bar should render a string.") public void setStringPainted(boolean b) { //PENDING: specify that string not painted when in indeterminate mode? // or just leave that to the L&F? @@ -506,11 +496,9 @@ public class JProgressBar extends JComponent implements SwingConstants, Accessib * @see #getString * @see #setStringPainted * @see #isStringPainted - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: Specifies the progress string to paint */ + @BeanProperty(visualUpdate = true, description + = "Specifies the progress string to paint") public void setString(String s){ String oldValue = progressString; progressString = s; @@ -526,6 +514,7 @@ public class JProgressBar extends JComponent implements SwingConstants, Accessib * * @return the percent complete for this progress bar */ + @BeanProperty(bound = false) public double getPercentComplete() { long span = model.getMaximum() - model.getMinimum(); double currentValue = model.getValue(); @@ -538,8 +527,6 @@ public class JProgressBar extends JComponent implements SwingConstants, Accessib * * @return the value of the borderPainted property * @see #setBorderPainted - * @beaninfo - * description: Does the progress bar paint its border */ public boolean isBorderPainted() { return paintBorder; @@ -556,11 +543,9 @@ public class JProgressBar extends JComponent implements SwingConstants, Accessib * should paint its border; * otherwise, false * @see #isBorderPainted - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: Whether the progress bar should paint its border. */ + @BeanProperty(visualUpdate = true, description + = "Whether the progress bar should paint its border.") public void setBorderPainted(boolean b) { boolean oldValue = paintBorder; paintBorder = b; @@ -601,12 +586,9 @@ public class JProgressBar extends JComponent implements SwingConstants, Accessib * * @param ui a ProgressBarUI object * @see UIDefaults#getUI - * @beaninfo - * bound: true - * hidden: true - * attribute: visualUpdate true - * description: The UI object that implements the Component's LookAndFeel. */ + @BeanProperty(hidden = true, visualUpdate = true, description + = "The UI object that implements the Component's LookAndFeel.") public void setUI(ProgressBarUI ui) { super.setUI(ui); } @@ -628,10 +610,9 @@ public class JProgressBar extends JComponent implements SwingConstants, Accessib * @return the string "ProgressBarUI" * @see JComponent#getUIClassID * @see UIDefaults#getUI - * @beaninfo - * expert: true - * description: A string that specifies the name of the look-and-feel class. */ + @BeanProperty(bound = false, expert = true, description + = "A string that specifies the name of the look-and-feel class.") public String getUIClassID() { return uiClassID; } @@ -702,6 +683,7 @@ public class JProgressBar extends JComponent implements SwingConstants, Accessib * array if no listeners have been added * @since 1.4 */ + @BeanProperty(bound = false) public ChangeListener[] getChangeListeners() { return listenerList.getListeners(ChangeListener.class); } @@ -752,11 +734,9 @@ public class JProgressBar extends JComponent implements SwingConstants, Accessib * and is set to {@code 0}. * * @param newModel the BoundedRangeModel to use - * - * @beaninfo - * expert: true - * description: The data model used by the JProgressBar. */ + @BeanProperty(bound = false, expert = true, description + = "The data model used by the JProgressBar.") public void setModel(BoundedRangeModel newModel) { // PENDING(???) setting the same model to multiple bars is broken; listeners BoundedRangeModel oldModel = getModel(); @@ -841,10 +821,9 @@ public class JProgressBar extends JComponent implements SwingConstants, Accessib * @see #getValue * @see #addChangeListener * @see BoundedRangeModel#setValue - * @beaninfo - * preferred: true - * description: The progress bar's current value. */ + @BeanProperty(bound = false, preferred = true, description + = "The progress bar's current value.") public void setValue(int n) { BoundedRangeModel brm = getModel(); int oldValue = brm.getValue(); @@ -874,10 +853,9 @@ public class JProgressBar extends JComponent implements SwingConstants, Accessib * @see #getMinimum * @see #addChangeListener * @see BoundedRangeModel#setMinimum - * @beaninfo - * preferred: true - * description: The progress bar's minimum value. */ + @BeanProperty(bound = false, preferred = true, description + = "The progress bar's minimum value.") public void setMinimum(int n) { getModel().setMinimum(n); } /** @@ -895,10 +873,9 @@ public class JProgressBar extends JComponent implements SwingConstants, Accessib * @see #getMaximum * @see #addChangeListener * @see BoundedRangeModel#setMaximum - * @beaninfo - * preferred: true - * description: The progress bar's maximum value. */ + @BeanProperty(bound = false, preferred = true, description + = "The progress bar's maximum value.") public void setMaximum(int n) { getModel().setMaximum(n); } /** @@ -925,12 +902,6 @@ public class JProgressBar extends JComponent implements SwingConstants, Accessib * @see javax.swing.plaf.basic.BasicProgressBarUI * * @since 1.4 - * - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: Set whether the progress bar is indeterminate (true) - * or normal (false). */ public void setIndeterminate(boolean newValue) { boolean oldValue = indeterminate; @@ -945,11 +916,9 @@ public class JProgressBar extends JComponent implements SwingConstants, Accessib * @see #setIndeterminate * * @since 1.4 - * - * @beaninfo - * description: Is the progress bar indeterminate (true) - * or normal (false)? */ + @BeanProperty(bound = false, description + = "Is the progress bar indeterminate (true) or normal (false)?") public boolean isIndeterminate() { return indeterminate; } @@ -1013,10 +982,9 @@ public class JProgressBar extends JComponent implements SwingConstants, Accessib * * @return an AccessibleJProgressBar that serves as the * AccessibleContext of this JProgressBar - * @beaninfo - * expert: true - * description: The AccessibleContext associated with this ProgressBar. */ + @BeanProperty(bound = false, expert = true, description + = "The AccessibleContext associated with this ProgressBar.") public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJProgressBar(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JRadioButton.java b/jdk/src/java.desktop/share/classes/javax/swing/JRadioButton.java index c5eaf6813bd..85c85407390 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JRadioButton.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JRadioButton.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,18 +24,15 @@ */ package javax.swing; -import java.awt.*; -import java.awt.event.*; -import java.beans.*; +import java.beans.JavaBean; +import java.beans.BeanProperty; import javax.swing.plaf.*; import javax.accessibility.*; import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; import java.io.IOException; - /** * An implementation of a radio button -- an item that can be selected or * deselected, and which displays its state to the user. @@ -78,15 +75,13 @@ import java.io.IOException; * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. * - * @beaninfo - * attribute: isContainer false - * description: A component which can display it's state as selected or deselected. - * * @see ButtonGroup * @see JCheckBox * @author Jeff Dinkins * @since 1.2 */ +@JavaBean(description = "A component which can display it's state as selected or deselected.") +@SwingContainer(false) @SuppressWarnings("serial") // Same-version serialization only public class JRadioButton extends JToggleButton implements Accessible { @@ -204,10 +199,9 @@ public class JRadioButton extends JToggleButton implements Accessible { * @return String "RadioButtonUI" * @see JComponent#getUIClassID * @see UIDefaults#getUI - * @beaninfo - * expert: true - * description: A string that specifies the name of the L&F class. */ + @BeanProperty(bound = false, expert = true, description + = "A string that specifies the name of the L&F class.") public String getUIClassID() { return uiClassID; } @@ -263,10 +257,9 @@ public class JRadioButton extends JToggleButton implements Accessible { * * @return an AccessibleJRadioButton that serves as the * AccessibleContext of this JRadioButton - * @beaninfo - * expert: true - * description: The AccessibleContext associated with this Button */ + @BeanProperty(bound = false, expert = true, description + = "The AccessibleContext associated with this Button") public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJRadioButton(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JRadioButtonMenuItem.java b/jdk/src/java.desktop/share/classes/javax/swing/JRadioButtonMenuItem.java index e1c219b4037..34a6cb7e0e5 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JRadioButtonMenuItem.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JRadioButtonMenuItem.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,17 +24,11 @@ */ package javax.swing; -import java.util.EventListener; - -import java.awt.*; -import java.awt.event.*; -import java.awt.image.*; - +import java.beans.JavaBean; +import java.beans.BeanProperty; import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; import java.io.IOException; -import javax.swing.plaf.*; import javax.accessibility.*; /** @@ -75,15 +69,13 @@ import javax.accessibility.*; * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. * - * @beaninfo - * attribute: isContainer false - * description: A component within a group of menu items which can be selected. - * * @author Georges Saab * @author David Karlton * @see ButtonGroup * @since 1.2 */ +@JavaBean(description = "A component within a group of menu items which can be selected.") +@SwingContainer(false) @SuppressWarnings("serial") // Same-version serialization only public class JRadioButtonMenuItem extends JMenuItem implements Accessible { /** @@ -191,6 +183,7 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible { * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; } @@ -248,6 +241,7 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible { * @return an AccessibleJRadioButtonMenuItem that serves as the * AccessibleContext of this JRadioButtonMenuItem */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJRadioButtonMenuItem(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JRootPane.java b/jdk/src/java.desktop/share/classes/javax/swing/JRootPane.java index f9dea90da3e..4061f2e2471 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JRootPane.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JRootPane.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,6 +34,7 @@ import javax.swing.plaf.RootPaneUI; import java.util.Vector; import java.io.Serializable; import javax.swing.border.*; + import sun.awt.AWTAccessor; import sun.security.action.GetBooleanAction; @@ -421,21 +422,18 @@ public class JRootPane extends JComponent implements Accessible { * FILE_CHOOSER_DIALOG, QUESTION_DIALOG, or * WARNING_DIALOG. * @since 1.4 - * @beaninfo - * bound: true - * enum: NONE JRootPane.NONE - * FRAME JRootPane.FRAME - * PLAIN_DIALOG JRootPane.PLAIN_DIALOG - * INFORMATION_DIALOG JRootPane.INFORMATION_DIALOG - * ERROR_DIALOG JRootPane.ERROR_DIALOG - * COLOR_CHOOSER_DIALOG JRootPane.COLOR_CHOOSER_DIALOG - * FILE_CHOOSER_DIALOG JRootPane.FILE_CHOOSER_DIALOG - * QUESTION_DIALOG JRootPane.QUESTION_DIALOG - * WARNING_DIALOG JRootPane.WARNING_DIALOG - * expert: true - * attribute: visualUpdate true - * description: Identifies the type of Window decorations to provide */ + @BeanProperty(expert = true, visualUpdate = true, enumerationValues = { + "JRootPane.NONE", + "JRootPane.FRAME", + "JRootPane.PLAIN_DIALOG", + "JRootPane.INFORMATION_DIALOG", + "JRootPane.ERROR_DIALOG", + "JRootPane.COLOR_CHOOSER_DIALOG", + "JRootPane.FILE_CHOOSER_DIALOG", + "JRootPane.QUESTION_DIALOG", + "JRootPane.WARNING_DIALOG"}, description + = "Identifies the type of Window decorations to provide") public void setWindowDecorationStyle(int windowDecorationStyle) { if (windowDecorationStyle < 0 || windowDecorationStyle > WARNING_DIALOG) { @@ -463,14 +461,10 @@ public class JRootPane extends JComponent implements Accessible { * * @param ui the LabelUI L&F object * @see UIDefaults#getUI - * @beaninfo - * bound: true - * hidden: true - * expert: true - * attribute: visualUpdate true - * description: The UI object that implements the Component's LookAndFeel. * @since 1.3 */ + @BeanProperty(expert = true, hidden = true, visualUpdate = true, description + = "The UI object that implements the Component's LookAndFeel.") public void setUI(RootPaneUI ui) { super.setUI(ui); } @@ -783,10 +777,9 @@ public class JRootPane extends JComponent implements Accessible { * * @see JButton#isDefaultButton * @param defaultButton the JButton which is to be the default button - * - * @beaninfo - * description: The button activated by default in this root pane */ + @BeanProperty(description + = "The button activated by default in this root pane") public void setDefaultButton(JButton defaultButton) { JButton oldDefault = this.defaultButton; diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JScrollBar.java b/jdk/src/java.desktop/share/classes/javax/swing/JScrollBar.java index 0f6b61640e7..39bae157b13 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JScrollBar.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JScrollBar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ - package javax.swing; import java.io.Serializable; @@ -31,18 +30,16 @@ import java.awt.Adjustable; import java.awt.Dimension; import java.awt.event.AdjustmentListener; import java.awt.event.AdjustmentEvent; -import java.awt.Graphics; +import java.beans.JavaBean; +import java.beans.BeanProperty; import javax.swing.event.*; import javax.swing.plaf.*; import javax.accessibility.*; import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; import java.io.IOException; - - /** * An implementation of a scrollbar. The user positions the knob in the * scrollbar to determine the contents of the viewing area. The @@ -72,13 +69,12 @@ import java.io.IOException; * Please see {@link java.beans.XMLEncoder}. * * @see JScrollPane - * @beaninfo - * attribute: isContainer false - * description: A component that helps determine the visible content range of an area. * * @author David Kloba * @since 1.2 */ +@JavaBean(defaultProperty = "UI", description = "A component that helps determine the visible content range of an area.") +@SwingContainer(false) @SuppressWarnings("serial") // Same-version serialization only public class JScrollBar extends JComponent implements Adjustable, Accessible { @@ -207,12 +203,9 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible * @param ui the ScrollBarUI {@literal L&F} object * @see UIDefaults#getUI * @since 1.4 - * @beaninfo - * bound: true - * hidden: true - * attribute: visualUpdate true - * description: The UI object that implements the Component's LookAndFeel */ + @BeanProperty(hidden = true, visualUpdate = true, description + = "The UI object that implements the Component's LookAndFeel") public void setUI(ScrollBarUI ui) { super.setUI(ui); } @@ -246,6 +239,7 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; } @@ -271,14 +265,11 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible * @param orientation an orientation of the {@code JScrollBar} * @exception IllegalArgumentException if orientation is not one of VERTICAL, HORIZONTAL * @see #getOrientation - * @beaninfo - * preferred: true - * bound: true - * attribute: visualUpdate true - * description: The scrollbar's orientation. - * enum: VERTICAL JScrollBar.VERTICAL - * HORIZONTAL JScrollBar.HORIZONTAL */ + @BeanProperty(preferred = true, visualUpdate = true, enumerationValues = { + "JScrollBar.VERTICAL", + "JScrollBar.HORIZONTAL"}, description + = "The scrollbar's orientation.") public void setOrientation(int orientation) { checkOrientation(orientation); @@ -319,11 +310,9 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible * * @param newModel a new model * @see #getModel - * @beaninfo - * bound: true - * expert: true - * description: The scrollbar's BoundedRangeModel. */ + @BeanProperty(expert = true, description + = "The scrollbar's BoundedRangeModel.") public void setModel(BoundedRangeModel newModel) { Integer oldValue = null; BoundedRangeModel oldModel = model; @@ -384,11 +373,9 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible * and ignore this property. * * @see #getUnitIncrement - * @beaninfo - * preferred: true - * bound: true - * description: The scrollbar's unit increment. */ + @BeanProperty(preferred = true, description + = "The scrollbar's unit increment.") public void setUnitIncrement(int unitIncrement) { int oldValue = this.unitIncrement; this.unitIncrement = unitIncrement; @@ -434,11 +421,9 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible * and ignore this property. * * @see #getBlockIncrement() - * @beaninfo - * preferred: true - * bound: true - * description: The scrollbar's block increment. */ + @BeanProperty(preferred = true, description + = "The scrollbar's block increment.") public void setBlockIncrement(int blockIncrement) { int oldValue = this.blockIncrement; this.blockIncrement = blockIncrement; @@ -482,10 +467,9 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible * * @see #getValue * @see BoundedRangeModel#setValue - * @beaninfo - * preferred: true - * description: The scrollbar's current value. */ + @BeanProperty(bound = false, preferred = true, description + = "The scrollbar's current value.") public void setValue(int value) { BoundedRangeModel m = getModel(); int oldValue = m.getValue(); @@ -518,10 +502,9 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible * * @see #getVisibleAmount * @see BoundedRangeModel#setExtent - * @beaninfo - * preferred: true - * description: The amount of the view that is currently visible. */ + @BeanProperty(bound = false, preferred = true, description + = "The amount of the view that is currently visible.") public void setVisibleAmount(int extent) { getModel().setExtent(extent); } @@ -544,10 +527,9 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible * * @see #getMinimum * @see BoundedRangeModel#setMinimum - * @beaninfo - * preferred: true - * description: The scrollbar's minimum value. */ + @BeanProperty(bound = false, preferred = true, description + = "The scrollbar's minimum value.") public void setMinimum(int minimum) { getModel().setMinimum(minimum); } @@ -570,10 +552,9 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible * * @see #getMaximum * @see BoundedRangeModel#setMaximum - * @beaninfo - * preferred: true - * description: The scrollbar's maximum value. */ + @BeanProperty(bound = false, preferred = true, description + = "The scrollbar's maximum value.") public void setMaximum(int maximum) { getModel().setMaximum(maximum); } @@ -601,10 +582,9 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible * * @see #getValueIsAdjusting * @see BoundedRangeModel#setValueIsAdjusting - * @beaninfo - * expert: true - * description: True if the scrollbar thumb is being dragged. */ + @BeanProperty(bound = false, expert = true, description + = "True if the scrollbar thumb is being dragged.") public void setValueIsAdjusting(boolean b) { BoundedRangeModel m = getModel(); boolean oldValue = m.getValueIsAdjusting(); @@ -693,6 +673,7 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible * array if no listeners have been added * @since 1.4 */ + @BeanProperty(bound = false) public AdjustmentListener[] getAdjustmentListeners() { return listenerList.getListeners(AdjustmentListener.class); } @@ -845,6 +826,7 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible * @return an AccessibleJScrollBar that serves as the * AccessibleContext of this JScrollBar */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJScrollBar(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JScrollPane.java b/jdk/src/java.desktop/share/classes/javax/swing/JScrollPane.java index 39700a68429..a51509baec3 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JScrollPane.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JScrollPane.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,6 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ - package javax.swing; import javax.swing.plaf.*; @@ -40,6 +39,8 @@ import java.awt.Point; import java.io.ObjectOutputStream; import java.io.IOException; +import java.beans.JavaBean; +import java.beans.BeanProperty; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.beans.Transient; @@ -161,14 +162,11 @@ import java.beans.Transient; * @see #setCorner * @see #setViewportBorder * - * @beaninfo - * attribute: isContainer true - * attribute: containerDelegate getViewport - * description: A specialized container that manages a viewport, optional scrollbars and headers - * * @author Hans Muller * @since 1.2 */ +@JavaBean(defaultProperty = "UI", description = "A specialized container that manages a viewport, optional scrollbars and headers") +@SwingContainer(delegate = "getViewport") @SuppressWarnings("serial") // Same-version serialization only public class JScrollPane extends JComponent implements ScrollPaneConstants, Accessible { @@ -360,12 +358,9 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce * @return the ScrollPaneUI object that renders this * component * @see #setUI - * @beaninfo - * bound: true - * hidden: true - * attribute: visualUpdate true - * description: The UI object that implements the Component's LookAndFeel. */ + @BeanProperty(hidden = true, visualUpdate = true, description + = "The UI object that implements the Component's LookAndFeel.") public ScrollPaneUI getUI() { return (ScrollPaneUI)ui; } @@ -403,10 +398,8 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce * @return the string "ScrollPaneUI" * @see JComponent#getUIClassID * @see UIDefaults#getUI - * - * @beaninfo - * hidden: true */ + @BeanProperty(bound = false, hidden = true) public String getUIClassID() { return uiClassID; } @@ -427,9 +420,6 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce * ScrollPaneLayout * @see java.awt.Container#getLayout * @see java.awt.Container#setLayout - * - * @beaninfo - * hidden: true */ public void setLayout(LayoutManager layout) { if (layout instanceof ScrollPaneLayout) { @@ -456,11 +446,9 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce * @see JComponent#revalidate * @see JComponent#isValidateRoot * @see java.awt.Container#isValidateRoot - * - * @beaninfo - * hidden: true */ @Override + @BeanProperty(hidden = true) public boolean isValidateRoot() { return true; } @@ -489,15 +477,12 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce * @exception IllegalArgumentException if policy * is not one of the legal values shown above * @see #getVerticalScrollBarPolicy - * - * @beaninfo - * preferred: true - * bound: true - * description: The scrollpane vertical scrollbar policy - * enum: VERTICAL_SCROLLBAR_AS_NEEDED ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED - * VERTICAL_SCROLLBAR_NEVER ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER - * VERTICAL_SCROLLBAR_ALWAYS ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS */ + @BeanProperty(preferred = true, enumerationValues = { + "ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED", + "ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER", + "ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS"}, description + = "The scrollpane vertical scrollbar policy") public void setVerticalScrollBarPolicy(int policy) { switch (policy) { case VERTICAL_SCROLLBAR_AS_NEEDED: @@ -537,15 +522,12 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce * @exception IllegalArgumentException if policy * is not one of the legal values shown above * @see #getHorizontalScrollBarPolicy - * - * @beaninfo - * preferred: true - * bound: true - * description: The scrollpane scrollbar policy - * enum: HORIZONTAL_SCROLLBAR_AS_NEEDED ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED - * HORIZONTAL_SCROLLBAR_NEVER ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER - * HORIZONTAL_SCROLLBAR_ALWAYS ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS */ + @BeanProperty(preferred = true, enumerationValues = { + "ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED", + "ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER", + "ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS"}, description + = "The scrollpane scrollbar policy") public void setHorizontalScrollBarPolicy(int policy) { switch (policy) { case HORIZONTAL_SCROLLBAR_AS_NEEDED: @@ -587,12 +569,9 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce * @param viewportBorder the border to be added * @see #getViewportBorder * @see #setViewport - * - * @beaninfo - * preferred: true - * bound: true - * description: The border around the viewport. */ + @BeanProperty(preferred = true, description + = "The border around the viewport.") public void setViewportBorder(Border viewportBorder) { Border oldValue = this.viewportBorder; this.viewportBorder = viewportBorder; @@ -605,6 +584,7 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce * * @return a Rectangle object specifying the viewport border */ + @BeanProperty(bound = false) public Rectangle getViewportBorderBounds() { Rectangle borderR = new Rectangle(getSize()); @@ -840,12 +820,9 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce * @param horizontalScrollBar the horizontal scrollbar to be added * @see #createHorizontalScrollBar * @see #getHorizontalScrollBar - * - * @beaninfo - * expert: true - * bound: true - * description: The horizontal scrollbar. */ + @BeanProperty(expert = true, description + = "The horizontal scrollbar.") public void setHorizontalScrollBar(JScrollBar horizontalScrollBar) { JScrollBar old = getHorizontalScrollBar(); this.horizontalScrollBar = horizontalScrollBar; @@ -899,12 +876,9 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce * @param verticalScrollBar the new vertical scrollbar to be added * @see #createVerticalScrollBar * @see #getVerticalScrollBar - * - * @beaninfo - * expert: true - * bound: true - * description: The vertical scrollbar. */ + @BeanProperty(expert = true, description + = "The vertical scrollbar.") public void setVerticalScrollBar(JScrollBar verticalScrollBar) { JScrollBar old = getVerticalScrollBar(); this.verticalScrollBar = verticalScrollBar; @@ -959,14 +933,9 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce * @see #createViewport * @see #getViewport * @see #setViewportView - * - * @beaninfo - * expert: true - * bound: true - * attribute: visualUpdate true - * description: The viewport child for this scrollpane - * */ + @BeanProperty(expert = true, visualUpdate = true, description + = "The viewport child for this scrollpane") public void setViewport(JViewport viewport) { JViewport old = getViewport(); this.viewport = viewport; @@ -1038,12 +1007,9 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce * is set to null * @see #getRowHeader * @see #setRowHeaderView - * - * @beaninfo - * bound: true - * expert: true - * description: The row header child for this scrollpane */ + @BeanProperty(expert = true, description + = "The row header child for this scrollpane") public void setRowHeader(JViewport rowHeader) { JViewport old = getRowHeader(); this.rowHeader = rowHeader; @@ -1105,12 +1071,9 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce * @param columnHeader a {@code JViewport} which is the new column header * @see #getColumnHeader * @see #setColumnHeaderView - * - * @beaninfo - * bound: true - * description: The column header child for this scrollpane - * attribute: visualUpdate true */ + @BeanProperty(visualUpdate = true, description + = "The column header child for this scrollpane") public void setColumnHeader(JViewport columnHeader) { JViewport old = getColumnHeader(); this.columnHeader = columnHeader; @@ -1303,10 +1266,9 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce * @return true if mouse wheel scrolling is enabled, false otherwise * @see #setWheelScrollingEnabled * @since 1.4 - * @beaninfo - * bound: true - * description: Flag for enabling/disabling mouse wheel scrolling */ + @BeanProperty(description + = "Flag for enabling/disabling mouse wheel scrolling") public boolean isWheelScrollingEnabled() {return wheelScrollState;} /** @@ -1320,10 +1282,9 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce * @see java.awt.event.MouseWheelEvent * @see java.awt.event.MouseWheelListener * @since 1.4 - * @beaninfo - * bound: true - * description: Flag for enabling/disabling mouse wheel scrolling */ + @BeanProperty(description + = "Flag for enabling/disabling mouse wheel scrolling") public void setWheelScrollingEnabled(boolean handleWheel) { boolean old = wheelScrollState; wheelScrollState = handleWheel; @@ -1424,6 +1385,7 @@ public class JScrollPane extends JComponent implements ScrollPaneConstants, Acce * @return an AccessibleJScrollPane that serves as the * AccessibleContext of this JScrollPane */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJScrollPane(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JSeparator.java b/jdk/src/java.desktop/share/classes/javax/swing/JSeparator.java index 2614096679b..cb3828a70c4 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JSeparator.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JSeparator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,17 +22,16 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ - package javax.swing; import javax.swing.plaf.*; import javax.accessibility.*; +import java.beans.JavaBean; +import java.beans.BeanProperty; import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; import java.io.IOException; - /** * JSeparator provides a general purpose component for * implementing divider lines - most commonly used as a divider @@ -64,14 +63,12 @@ import java.io.IOException; * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. * - * @beaninfo - * attribute: isContainer false - * description: A divider between menu items. - * * @author Georges Saab * @author Jeff Shapiro * @since 1.2 */ +@JavaBean(defaultProperty = "UI", description = "A divider between menu items.") +@SwingContainer(false) @SuppressWarnings("serial") public class JSeparator extends JComponent implements SwingConstants, Accessible { @@ -122,12 +119,9 @@ public class JSeparator extends JComponent implements SwingConstants, Accessible * * @param ui the SeparatorUI L&F object * @see UIDefaults#getUI - * @beaninfo - * bound: true - * hidden: true - * attribute: visualUpdate true - * description: The UI object that implements the Component's LookAndFeel. */ + @BeanProperty(hidden = true, visualUpdate = true, description + = "The UI object that implements the Component's LookAndFeel.") public void setUI(SeparatorUI ui) { super.setUI(ui); } @@ -149,6 +143,7 @@ public class JSeparator extends JComponent implements SwingConstants, Accessible * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; } @@ -196,14 +191,11 @@ public class JSeparator extends JComponent implements SwingConstants, Accessible * * @see SwingConstants * @see #getOrientation - * @beaninfo - * bound: true - * preferred: true - * enum: HORIZONTAL SwingConstants.HORIZONTAL - * VERTICAL SwingConstants.VERTICAL - * attribute: visualUpdate true - * description: The orientation of the separator. */ + @BeanProperty(preferred = true, visualUpdate = true, enumerationValues = { + "SwingConstants.HORIZONTAL", + "SwingConstants.VERTICAL"}, description + = "The orientation of the separator.") public void setOrientation( int orientation ) { if (this.orientation == orientation) { return; @@ -260,6 +252,7 @@ public class JSeparator extends JComponent implements SwingConstants, Accessible * @return an AccessibleJSeparator that serves as the * AccessibleContext of this JSeparator */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJSeparator(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JSlider.java b/jdk/src/java.desktop/share/classes/javax/swing/JSlider.java index 5475d51ffc4..dce14e15bcf 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JSlider.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JSlider.java @@ -22,7 +22,6 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ - package javax.swing; import javax.swing.event.*; @@ -35,8 +34,10 @@ import java.io.IOException; import java.awt.*; import java.util.*; -import java.beans.*; - +import java.beans.JavaBean; +import java.beans.BeanProperty; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; /** * A component that lets the user graphically select a value by sliding @@ -72,13 +73,11 @@ import java.beans.*; * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. * - * @beaninfo - * attribute: isContainer false - * description: A component that supports selecting a integer value from a range. - * * @author David Kloba * @since 1.2 */ +@JavaBean(defaultProperty = "UI", description = "A component that supports selecting a integer value from a range.") +@SwingContainer(false) @SuppressWarnings("serial") // Same-version serialization only public class JSlider extends JComponent implements SwingConstants, Accessible { /** @@ -310,12 +309,9 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { * * @param ui the SliderUI L&F object * @see UIDefaults#getUI - * @beaninfo - * bound: true - * hidden: true - * attribute: visualUpdate true - * description: The UI object that implements the slider's LookAndFeel. */ + @BeanProperty(hidden = true, visualUpdate = true, description + = "The UI object that implements the slider's LookAndFeel.") public void setUI(SliderUI ui) { super.setUI(ui); } @@ -343,6 +339,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; } @@ -413,6 +410,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { * array if no listeners have been added * @since 1.4 */ + @BeanProperty(bound = false) public ChangeListener[] getChangeListeners() { return listenerList.getListeners(ChangeListener.class); } @@ -468,10 +466,9 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { * * @see #getModel * @see BoundedRangeModel - * @beaninfo - * bound: true - * description: The sliders BoundedRangeModel. */ + @BeanProperty(description + = "The sliders BoundedRangeModel.") public void setModel(BoundedRangeModel newModel) { BoundedRangeModel oldModel = getModel(); @@ -527,10 +524,9 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { * @see #getValue * @see #addChangeListener * @see BoundedRangeModel#setValue - * @beaninfo - * preferred: true - * description: The sliders current value. */ + @BeanProperty(bound = false, preferred = true, description + = "The sliders current value.") public void setValue(int n) { BoundedRangeModel m = getModel(); int oldValue = m.getValue(); @@ -577,11 +573,9 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { * @see #getMinimum * @see #addChangeListener * @see BoundedRangeModel#setMinimum - * @beaninfo - * bound: true - * preferred: true - * description: The sliders minimum value. */ + @BeanProperty(preferred = true, description + = "The sliders minimum value.") public void setMinimum(int minimum) { int oldMin = getModel().getMinimum(); getModel().setMinimum(minimum); @@ -618,11 +612,9 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { * @see #getMaximum * @see #addChangeListener * @see BoundedRangeModel#setMaximum - * @beaninfo - * bound: true - * preferred: true - * description: The sliders maximum value. */ + @BeanProperty(preferred = true, description + = "The sliders maximum value.") public void setMaximum(int maximum) { int oldMax = getModel().getMaximum(); getModel().setMaximum(maximum); @@ -651,10 +643,9 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { * @param b the new value for the {@code valueIsAdjusting} property * @see #getValueIsAdjusting * @see BoundedRangeModel#setValueIsAdjusting - * @beaninfo - * expert: true - * description: True if the slider knob is being dragged. */ + @BeanProperty(bound = false, expert = true, description + = "True if the slider knob is being dragged.") public void setValueIsAdjusting(boolean b) { BoundedRangeModel m = getModel(); boolean oldValue = m.getValueIsAdjusting(); @@ -699,10 +690,9 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { * @param extent the new extent * @see #getExtent * @see BoundedRangeModel#setExtent - * @beaninfo - * expert: true - * description: Size of the range covered by the knob. */ + @BeanProperty(bound = false, expert = true, description + = "Size of the range covered by the knob.") public void setExtent(int extent) { getModel().setExtent(extent); } @@ -726,15 +716,11 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { * @param orientation {@code HORIZONTAL} or {@code VERTICAL} * @throws IllegalArgumentException if orientation is not one of {@code VERTICAL}, {@code HORIZONTAL} * @see #getOrientation - * @beaninfo - * preferred: true - * bound: true - * attribute: visualUpdate true - * description: Set the scrollbars orientation to either VERTICAL or HORIZONTAL. - * enum: VERTICAL JSlider.VERTICAL - * HORIZONTAL JSlider.HORIZONTAL - * */ + @BeanProperty(preferred = true, visualUpdate = true, enumerationValues = { + "JSlider.VERTICAL", + "JSlider.HORIZONTAL"}, description + = "Set the scrollbars orientation to either VERTICAL or HORIZONTAL.") public void setOrientation(int orientation) { checkOrientation(orientation); @@ -828,12 +814,9 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { * @see #createStandardLabels(int) * @see #getLabelTable * @see #setPaintLabels - * @beaninfo - * hidden: true - * bound: true - * attribute: visualUpdate true - * description: Specifies what labels will be drawn for any given value. */ + @BeanProperty(hidden = true, visualUpdate = true, description + = "Specifies what labels will be drawn for any given value.") @SuppressWarnings("rawtypes") public void setLabelTable( Dictionary labels ) { Dictionary oldTable = labelTable; @@ -1062,12 +1045,9 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { * By default, the value of this property is {@code false}. * * @param b true to reverse the slider values from their normal order - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: If true reverses the slider values from their normal order - * */ + @BeanProperty(visualUpdate = true, description + = "If true reverses the slider values from their normal order") public void setInverted( boolean b ) { boolean oldValue = isInverted; isInverted = b; @@ -1118,12 +1098,9 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { * @see #setPaintTicks * @see #setLabelTable * @see #createStandardLabels(int) - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: Sets the number of values between major tick marks. - * */ + @BeanProperty(visualUpdate = true, description + = "Sets the number of values between major tick marks.") public void setMajorTickSpacing(int n) { int oldValue = majorTickSpacing; majorTickSpacing = n; @@ -1166,11 +1143,9 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { * @param n new value for the {@code minorTickSpacing} property * @see #getMinorTickSpacing * @see #setPaintTicks - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: Sets the number of values between minor tick marks. */ + @BeanProperty(visualUpdate = true, description + = "Sets the number of values between minor tick marks.") public void setMinorTickSpacing(int n) { int oldValue = minorTickSpacing; minorTickSpacing = n; @@ -1215,10 +1190,9 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { * * @param b true to snap the knob to the nearest tick mark * @see #getSnapToTicks - * @beaninfo - * bound: true - * description: If true snap the knob to the nearest tick mark. */ + @BeanProperty(description + = "If true snap the knob to the nearest tick mark.") public void setSnapToTicks(boolean b) { boolean oldValue = snapToTicks; snapToTicks = b; @@ -1236,10 +1210,9 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { * @param b true to snap the knob to the nearest slider value * @see #getSnapToValue * @see #setSnapToTicks - * @beaninfo - * bound: true - * description: If true snap the knob to the nearest slider value. */ + @BeanProperty(description + = "If true snap the knob to the nearest slider value.") void setSnapToValue(boolean b) { boolean oldValue = snapToValue; snapToValue = b; @@ -1263,11 +1236,9 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { * * @param b whether or not tick marks should be painted * @see #getPaintTicks - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: If true tick marks are painted on the slider. */ + @BeanProperty(visualUpdate = true, description + = "If true tick marks are painted on the slider.") public void setPaintTicks(boolean b) { boolean oldValue = paintTicks; paintTicks = b; @@ -1294,11 +1265,9 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { * * @param b whether or not to paint the slider track * @see #getPaintTrack - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: If true, the track is painted on the slider. */ + @BeanProperty(visualUpdate = true, description + = "If true, the track is painted on the slider.") public void setPaintTrack(boolean b) { boolean oldValue = paintTrack; paintTrack = b; @@ -1336,11 +1305,9 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { * @see #getPaintLabels * @see #getLabelTable * @see #createStandardLabels(int) - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: If true labels are painted on the slider. */ + @BeanProperty(visualUpdate = true, description + = "If true labels are painted on the slider.") public void setPaintLabels(boolean b) { boolean oldValue = paintLabels; paintLabels = b; @@ -1422,6 +1389,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible { * @return an AccessibleJSlider that serves as the * AccessibleContext of this JSlider */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJSlider(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JSpinner.java b/jdk/src/java.desktop/share/classes/javax/swing/JSpinner.java index 42b1dc39b3b..b9a26cf4b40 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JSpinner.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JSpinner.java @@ -108,11 +108,6 @@ import sun.util.locale.provider.LocaleResources; * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. * - * @beaninfo - * attribute: isContainer false - * description: A single line input field that lets the user select a - * number or an object value from an ordered set. - * * @see SpinnerModel * @see AbstractSpinnerModel * @see SpinnerListModel @@ -124,6 +119,8 @@ import sun.util.locale.provider.LocaleResources; * @author Lynn Monsanto (accessibility) * @since 1.4 */ +@JavaBean(defaultProperty = "UI", description = "A single line input field that lets the user select a number or an object value from an ordered set.") +@SwingContainer(false) @SuppressWarnings("serial") // Same-version serialization only public class JSpinner extends JComponent implements Accessible { @@ -199,6 +196,7 @@ public class JSpinner extends JComponent implements Accessible * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; } @@ -273,12 +271,9 @@ public class JSpinner extends JComponent implements Accessible * @see #getEditor * @see #setEditor * @throws IllegalArgumentException if model is null - * - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: Model that represents the value of this spinner. */ + @BeanProperty(visualUpdate = true, description + = "Model that represents the value of this spinner.") public void setModel(SpinnerModel model) { if (model == null) { throw new IllegalArgumentException("null model"); @@ -376,6 +371,7 @@ public class JSpinner extends JComponent implements Accessible * @see #getPreviousValue * @see SpinnerModel#getNextValue */ + @BeanProperty(bound = false) public Object getNextValue() { return getModel().getNextValue(); } @@ -436,6 +432,7 @@ public class JSpinner extends JComponent implements Accessible * array if no listeners have been added * @since 1.4 */ + @BeanProperty(bound = false) public ChangeListener[] getChangeListeners() { return listenerList.getListeners(ChangeListener.class); } @@ -484,6 +481,7 @@ public class JSpinner extends JComponent implements Accessible * @see #getNextValue * @see SpinnerModel#getPreviousValue */ + @BeanProperty(bound = false) public Object getPreviousValue() { return getModel().getPreviousValue(); } @@ -502,12 +500,9 @@ public class JSpinner extends JComponent implements Accessible * @see #createEditor * @see #getModel * @throws IllegalArgumentException if editor is null - * - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: JComponent that displays the current value of the model */ + @BeanProperty(visualUpdate = true, description + = "JComponent that displays the current value of the model") public void setEditor(JComponent editor) { if (editor == null) { throw new IllegalArgumentException("null editor"); @@ -1427,6 +1422,7 @@ public class JSpinner extends JComponent implements Accessible * @return the AccessibleContext for the JSpinner * @since 1.5 */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJSpinner(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JSplitPane.java b/jdk/src/java.desktop/share/classes/javax/swing/JSplitPane.java index 4b490b76cc4..8c38fa2df59 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JSplitPane.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JSplitPane.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,12 +23,10 @@ * questions. */ - - package javax.swing; - - +import java.beans.JavaBean; +import java.beans.BeanProperty; import java.beans.ConstructorProperties; import javax.swing.plaf.*; import javax.accessibility.*; @@ -36,11 +34,8 @@ import javax.accessibility.*; import java.awt.*; import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; import java.io.IOException; - - /** * JSplitPane is used to divide two (and only two) * Components. The two Components @@ -99,6 +94,7 @@ import java.io.IOException; * @author Scott Violet * @since 1.2 */ +@JavaBean(defaultProperty = "UI") @SuppressWarnings("serial") // Same-version serialization only public class JSplitPane extends JComponent implements Accessible { @@ -365,11 +361,6 @@ public class JSplitPane extends JComponent implements Accessible * * @param ui the SplitPaneUI L&F object * @see UIDefaults#getUI - * @beaninfo - * bound: true - * hidden: true - * attribute: visualUpdate true - * description: The UI object that implements the Component's LookAndFeel. */ public void setUI(SplitPaneUI ui) { if ((SplitPaneUI)this.ui != ui) { @@ -384,10 +375,9 @@ public class JSplitPane extends JComponent implements Accessible * current look and feel. * * @return the SplitPaneUI object that renders this component - * @beaninfo - * expert: true - * description: The L&F object that renders this component. */ + @BeanProperty(bound = false, expert = true, description + = "The L&F object that renders this component.") public SplitPaneUI getUI() { return (SplitPaneUI)ui; } @@ -412,10 +402,9 @@ public class JSplitPane extends JComponent implements Accessible * @return the string "SplitPaneUI" * @see JComponent#getUIClassID * @see UIDefaults#getUI - * @beaninfo - * expert: true - * description: A string that specifies the name of the L&F class. */ + @BeanProperty(bound = false, expert = true, description + = "A string that specifies the name of the L&F class.") public String getUIClassID() { return uiClassID; } @@ -425,10 +414,9 @@ public class JSplitPane extends JComponent implements Accessible * Sets the size of the divider. * * @param newSize an integer giving the size of the divider in pixels - * @beaninfo - * bound: true - * description: The size of the divider. */ + @BeanProperty(description + = "The size of the divider.") public void setDividerSize(int newSize) { int oldSize = dividerSize; @@ -471,10 +459,9 @@ public class JSplitPane extends JComponent implements Accessible * Returns the component to the left (or above) the divider. * * @return the Component displayed in that position - * @beaninfo - * preferred: true - * description: The component to the left (or above) the divider. */ + @BeanProperty(bound = false, preferred = true, description + = "The component to the left (or above) the divider.") public Component getLeftComponent() { return leftComponent; } @@ -484,9 +471,9 @@ public class JSplitPane extends JComponent implements Accessible * Sets the component above, or to the left of the divider. * * @param comp the Component to display in that position - * @beaninfo - * description: The component above, or to the left of the divider. */ + @BeanProperty(bound = false, description + = "The component above, or to the left of the divider.") public void setTopComponent(Component comp) { setLeftComponent(comp); } @@ -506,10 +493,9 @@ public class JSplitPane extends JComponent implements Accessible * Sets the component to the right (or below) the divider. * * @param comp the Component to display in that position - * @beaninfo - * preferred: true - * description: The component to the right (or below) the divider. */ + @BeanProperty(bound = false, preferred = true, description + = "The component to the right (or below) the divider.") public void setRightComponent(Component comp) { if (comp == null) { if (rightComponent != null) { @@ -536,9 +522,9 @@ public class JSplitPane extends JComponent implements Accessible * Sets the component below, or to the right of the divider. * * @param comp the Component to display in that position - * @beaninfo - * description: The component below, or to the right of the divider. */ + @BeanProperty(bound = false, description + = "The component below, or to the right of the divider.") public void setBottomComponent(Component comp) { setRightComponent(comp); } @@ -565,13 +551,11 @@ public class JSplitPane extends JComponent implements Accessible * * @param newValue true to specify that the split pane should provide a * collapse/expand widget - * @beaninfo - * bound: true - * description: UI widget on the divider to quickly - * expand/collapse the divider. * * @see #isOneTouchExpandable */ + @BeanProperty(description + = "UI widget on the divider to quickly expand/collapse the divider.") public void setOneTouchExpandable(boolean newValue) { boolean oldValue = oneTouchExpandable; @@ -600,10 +584,9 @@ public class JSplitPane extends JComponent implements Accessible * @param newLastLocation an integer specifying the last divider location * in pixels, from the left (or upper) edge of the pane to the * left (or upper) edge of the divider - * @beaninfo - * bound: true - * description: The last location the divider was at. */ + @BeanProperty(description + = "The last location the divider was at.") public void setLastDividerLocation(int newLastLocation) { int oldLocation = lastDividerLocation; @@ -635,12 +618,11 @@ public class JSplitPane extends JComponent implements Accessible * @param orientation an integer specifying the orientation * @exception IllegalArgumentException if orientation is not one of: * HORIZONTAL_SPLIT or VERTICAL_SPLIT. - * @beaninfo - * bound: true - * description: The orientation, or how the splitter is divided. - * enum: HORIZONTAL_SPLIT JSplitPane.HORIZONTAL_SPLIT - * VERTICAL_SPLIT JSplitPane.VERTICAL_SPLIT */ + @BeanProperty(enumerationValues = { + "JSplitPane.HORIZONTAL_SPLIT", + "JSplitPane.VERTICAL_SPLIT"}, description + = "The orientation, or how the splitter is divided.") public void setOrientation(int orientation) { if ((orientation != VERTICAL_SPLIT) && (orientation != HORIZONTAL_SPLIT)) { @@ -679,13 +661,10 @@ public class JSplitPane extends JComponent implements Accessible * * @param newContinuousLayout true if the components * should continuously be redrawn as the divider changes position - * @beaninfo - * bound: true - * description: Whether the child components are - * continuously redisplayed and laid out during - * user intervention. * @see #isContinuousLayout */ + @BeanProperty(description + = "Whether the child components are continuously redisplayed and laid out during user intervention.") public void setContinuousLayout(boolean newContinuousLayout) { boolean oldCD = continuousLayout; @@ -718,11 +697,9 @@ public class JSplitPane extends JComponent implements Accessible * @param value as described above * @exception IllegalArgumentException if value is < 0 or > 1 * @since 1.3 - * @beaninfo - * bound: true - * description: Specifies how to distribute extra space when the split pane - * resizes. */ + @BeanProperty(description + = "Specifies how to distribute extra space when the split pane resizes.") public void setResizeWeight(double value) { if (value < 0 || value > 1) { throw new IllegalArgumentException("JSplitPane weight must be between 0 and 1"); @@ -773,9 +750,9 @@ public class JSplitPane extends JComponent implements Accessible * (bottom/right) * @exception IllegalArgumentException if the specified location is < 0 * or > 1.0 - * @beaninfo - * description: The location of the divider. */ + @BeanProperty(description + = "The location of the divider.") public void setDividerLocation(double proportionalLocation) { if (proportionalLocation < 0.0 || proportionalLocation > 1.0) { @@ -802,10 +779,9 @@ public class JSplitPane extends JComponent implements Accessible * * @param location an int specifying a UI-specific value (typically a * pixel count) - * @beaninfo - * bound: true - * description: The location of the divider. */ + @BeanProperty(description + = "The location of the divider.") public void setDividerLocation(int location) { int oldValue = dividerLocation; @@ -846,9 +822,9 @@ public class JSplitPane extends JComponent implements Accessible * @return an integer specifying a UI-specific value for the minimum * location (typically a pixel count); or -1 if the UI is * null - * @beaninfo - * description: The minimum location of the divider from the L&F. */ + @BeanProperty(bound = false, description + = "The minimum location of the divider from the L&F.") public int getMinimumDividerLocation() { SplitPaneUI ui = getUI(); @@ -867,6 +843,7 @@ public class JSplitPane extends JComponent implements Accessible * location (typically a pixel count); or -1 if the UI is * null */ + @BeanProperty(bound = false) public int getMaximumDividerLocation() { SplitPaneUI ui = getUI(); @@ -947,11 +924,9 @@ public class JSplitPane extends JComponent implements Accessible * @return true * @see JComponent#revalidate * @see java.awt.Container#isValidateRoot - * - * @beaninfo - * hidden: true */ @Override + @BeanProperty(hidden = true) public boolean isValidateRoot() { return true; } @@ -1132,10 +1107,9 @@ public class JSplitPane extends JComponent implements Accessible * * @return an AccessibleJSplitPane that serves as the * AccessibleContext of this JSplitPane - * @beaninfo - * expert: true - * description: The AccessibleContext associated with this SplitPane. */ + @BeanProperty(bound = false, expert = true, description + = "The AccessibleContext associated with this SplitPane.") public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJSplitPane(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JTabbedPane.java b/jdk/src/java.desktop/share/classes/javax/swing/JTabbedPane.java index 7afe712868a..d50e660e413 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JTabbedPane.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JTabbedPane.java @@ -22,16 +22,18 @@ * 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.beans.Transient; import java.util.*; import javax.swing.event.*; import javax.swing.plaf.*; import javax.accessibility.*; + import sun.swing.SwingUtilities2; import java.io.Serializable; @@ -95,11 +97,6 @@ import java.io.IOException; * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. * - * @beaninfo - * attribute: isContainer true - * description: A component which provides a tab folder metaphor for - * displaying one component from a set of components. - * * @author Dave Moore * @author Philip Milne * @author Amy Fowler @@ -107,6 +104,8 @@ import java.io.IOException; * @see SingleSelectionModel * @since 1.2 */ +@JavaBean(defaultProperty = "UI", description = "A component which provides a tab folder metaphor for displaying one component from a set of components.") +@SwingContainer @SuppressWarnings("serial") // Same-version serialization only public class JTabbedPane extends JComponent implements Serializable, Accessible, SwingConstants { @@ -223,12 +222,9 @@ public class JTabbedPane extends JComponent * * @param ui the new UI object * @see UIDefaults#getUI - * @beaninfo - * bound: true - * hidden: true - * attribute: visualUpdate true - * description: The UI object that implements the tabbedpane's LookAndFeel */ + @BeanProperty(hidden = true, visualUpdate = true, description + = "The UI object that implements the tabbedpane's LookAndFeel") public void setUI(TabbedPaneUI ui) { super.setUI(ui); // disabled icons are generated by LF so they should be unset here @@ -258,6 +254,7 @@ public class JTabbedPane extends JComponent * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; } @@ -315,7 +312,8 @@ public class JTabbedPane extends JComponent * array if no listeners have been added * @since 1.4 */ - public ChangeListener[] getChangeListeners() { + @BeanProperty(bound = false) + public ChangeListener[] getChangeListeners() { return listenerList.getListeners(ChangeListener.class); } @@ -437,10 +435,9 @@ public class JTabbedPane extends JComponent * * @param model the model to be used * @see #getModel - * @beaninfo - * bound: true - * description: The tabbedpane's SingleSelectionModel. */ + @BeanProperty(description + = "The tabbedpane's SingleSelectionModel.") public void setModel(SingleSelectionModel model) { SingleSelectionModel oldModel = getModel(); @@ -483,18 +480,13 @@ public class JTabbedPane extends JComponent * @param tabPlacement the placement for the tabs relative to the content * @exception IllegalArgumentException if tab placement value isn't one * of the above valid values - * - * @beaninfo - * preferred: true - * bound: true - * attribute: visualUpdate true - * enum: TOP JTabbedPane.TOP - * LEFT JTabbedPane.LEFT - * BOTTOM JTabbedPane.BOTTOM - * RIGHT JTabbedPane.RIGHT - * description: The tabbedpane's tab placement. - * */ + @BeanProperty(preferred = true, visualUpdate = true, enumerationValues = { + "JTabbedPane.TOP", + "JTabbedPane.LEFT", + "JTabbedPane.BOTTOM", + "JTabbedPane.RIGHT"}, description + = "The tabbedpane's tab placement.") public void setTabPlacement(int tabPlacement) { checkTabPlacement(tabPlacement); if (this.tabPlacement != tabPlacement) { @@ -546,16 +538,11 @@ public class JTabbedPane extends JComponent * of the above valid values * @see #getTabLayoutPolicy * @since 1.4 - * - * @beaninfo - * preferred: true - * bound: true - * attribute: visualUpdate true - * enum: WRAP_TAB_LAYOUT JTabbedPane.WRAP_TAB_LAYOUT - * SCROLL_TAB_LAYOUT JTabbedPane.SCROLL_TAB_LAYOUT - * description: The tabbedpane's policy for laying out the tabs - * */ + @BeanProperty(preferred = true, visualUpdate = true, enumerationValues = { + "JTabbedPane.WRAP_TAB_LAYOUT", + "JTabbedPane.SCROLL_TAB_LAYOUT"}, description + = "The tabbedpane's policy for laying out the tabs") public void setTabLayoutPolicy(int tabLayoutPolicy) { checkTabLayoutPolicy(tabLayoutPolicy); if (this.tabLayoutPolicy != tabLayoutPolicy) { @@ -600,10 +587,9 @@ public class JTabbedPane extends JComponent * * @see #getSelectedIndex * @see SingleSelectionModel#setSelectedIndex - * @beaninfo - * preferred: true - * description: The tabbedpane's selected tab index. */ + @BeanProperty(bound = false, preferred = true, description + = "The tabbedpane's selected tab index.") public void setSelectedIndex(int index) { if (index != -1) { checkIndex(index); @@ -686,10 +672,9 @@ public class JTabbedPane extends JComponent * @exception IllegalArgumentException if component not found in tabbed * pane * @see #getSelectedComponent - * @beaninfo - * preferred: true - * description: The tabbedpane's selected component. */ + @BeanProperty(bound = false, preferred = true, description + = "The tabbedpane's selected component.") public void setSelectedComponent(Component c) { int index = indexOfComponent(c); if (index != -1) { @@ -1096,6 +1081,7 @@ public class JTabbedPane extends JComponent * * @return an integer specifying the number of tabbed pages */ + @BeanProperty(bound = false) public int getTabCount() { return pages.size(); } @@ -1111,6 +1097,7 @@ public class JTabbedPane extends JComponent * is LEFT or RIGHT, * or 0 if there is no UI set on this tabbedpane */ + @BeanProperty(bound = false) public int getTabRunCount() { if (ui != null) { return ((TabbedPaneUI)ui).getTabRunCount(this); @@ -1329,11 +1316,9 @@ public class JTabbedPane extends JComponent * * @see #getTitleAt * @see #setTabComponentAt - * @beaninfo - * preferred: true - * attribute: visualUpdate true - * description: The title at the specified tab index. */ + @BeanProperty(preferred = true, visualUpdate = true, description + = "The title at the specified tab index.") public void setTitleAt(int index, String title) { Page page = pages.get(index); String oldTitle =page.title; @@ -1373,11 +1358,9 @@ public class JTabbedPane extends JComponent * @see #getIconAt * @see #getDisabledIconAt * @see #setTabComponentAt - * @beaninfo - * preferred: true - * attribute: visualUpdate true - * description: The icon at the specified tab index. */ + @BeanProperty(preferred = true, visualUpdate = true, description + = "The icon at the specified tab index.") public void setIconAt(int index, Icon icon) { Page page = pages.get(index); Icon oldIcon = page.icon; @@ -1414,11 +1397,9 @@ public class JTabbedPane extends JComponent * {@code (index < 0 || index >= tab count)} * * @see #getDisabledIconAt - * @beaninfo - * preferred: true - * attribute: visualUpdate true - * description: The disabled icon at the specified tab index. */ + @BeanProperty(preferred = true, visualUpdate = true, description + = "The disabled icon at the specified tab index.") public void setDisabledIconAt(int index, Icon disabledIcon) { Icon oldIcon = pages.get(index).disabledIcon; pages.get(index).disabledIcon = disabledIcon; @@ -1439,11 +1420,10 @@ public class JTabbedPane extends JComponent * {@code (index < 0 || index >= tab count)} * * @see #getToolTipTextAt - * @beaninfo - * preferred: true - * description: The tooltip text at the specified tab index. * @since 1.3 */ + @BeanProperty(preferred = true, description + = "The tooltip text at the specified tab index.") public void setToolTipTextAt(int index, String toolTipText) { String oldToolTipText = pages.get(index).tip; pages.get(index).tip = toolTipText; @@ -1475,11 +1455,9 @@ public class JTabbedPane extends JComponent * {@code (index < 0 || index >= tab count)} * * @see #getBackgroundAt - * @beaninfo - * preferred: true - * attribute: visualUpdate true - * description: The background color at the specified tab index. */ + @BeanProperty(preferred = true, visualUpdate = true, description + = "The background color at the specified tab index.") public void setBackgroundAt(int index, Color background) { Color oldBg = pages.get(index).background; pages.get(index).setBackground(background); @@ -1508,11 +1486,9 @@ public class JTabbedPane extends JComponent * {@code (index < 0 || index >= tab count)} * * @see #getForegroundAt - * @beaninfo - * preferred: true - * attribute: visualUpdate true - * description: The foreground color at the specified tab index. */ + @BeanProperty(preferred = true, visualUpdate = true, description + = "The foreground color at the specified tab index.") public void setForegroundAt(int index, Color foreground) { Color oldFg = pages.get(index).foreground; pages.get(index).setForeground(foreground); @@ -1555,10 +1531,9 @@ public class JTabbedPane extends JComponent * {@code (index < 0 || index >= tab count)} * * @see #getComponentAt - * @beaninfo - * attribute: visualUpdate true - * description: The component at the specified tab index. */ + @BeanProperty(visualUpdate = true, description + = "The component at the specified tab index.") @SuppressWarnings("deprecation") public void setComponentAt(int index, Component component) { Page page = pages.get(index); @@ -1635,13 +1610,9 @@ public class JTabbedPane extends JComponent * title , or < -1 * @see #setMnemonicAt(int,int) * @see #getDisplayedMnemonicIndexAt(int) - * - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: the index into the String to draw the keyboard character - * mnemonic at */ + @BeanProperty(visualUpdate = true, description + = "the index into the String to draw the keyboard character mnemonic at") public void setDisplayedMnemonicIndexAt(int tabIndex, int mnemonicIndex) { checkIndex(tabIndex); @@ -1675,13 +1646,9 @@ public class JTabbedPane extends JComponent * of range ({@code tabIndex < 0 || tabIndex >= tab count}) * @see #getMnemonicAt(int) * @see #setDisplayedMnemonicIndexAt(int,int) - * - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: The keyboard mnenmonic, as a KeyEvent VK constant, - * for the specified tab */ + @BeanProperty(visualUpdate = true, description + = "The keyboard mnenmonic, as a KeyEvent VK constant, for the specified tab") public void setMnemonicAt(int tabIndex, int mnemonic) { checkIndex(tabIndex); @@ -1896,6 +1863,7 @@ public class JTabbedPane extends JComponent * @return an AccessibleJTabbedPane that serves as the * AccessibleContext of this JTabbedPane */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJTabbedPane(); @@ -2397,12 +2365,10 @@ public class JTabbedPane extends JComponent * added to this JTabbedPane * * @see #getTabComponentAt - * @beaninfo - * preferred: true - * attribute: visualUpdate true - * description: The tab component at the specified tab index. * @since 1.6 */ + @BeanProperty(preferred = true, visualUpdate = true, description + = "The tab component at the specified tab index.") public void setTabComponentAt(int index, Component component) { if (component != null && indexOfComponent(component) != -1) { throw new IllegalArgumentException("Component is already added to this JTabbedPane"); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JTable.java b/jdk/src/java.desktop/share/classes/javax/swing/JTable.java index 6b83043597e..f00473866a7 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JTable.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JTable.java @@ -22,7 +22,6 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ - package javax.swing; import java.util.*; @@ -32,7 +31,10 @@ import java.awt.*; import java.awt.event.*; import java.awt.print.*; -import java.beans.*; +import java.beans.JavaBean; +import java.beans.BeanProperty; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; import java.io.ObjectOutputStream; import java.io.ObjectInputStream; @@ -207,11 +209,6 @@ import sun.swing.PrintingStatus; * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. * - * - * @beaninfo - * attribute: isContainer false - * description: A component which displays data in a two dimensional grid. - * * @author Philip Milne * @author Shannon Hickey (printing support) * @see javax.swing.table.DefaultTableModel @@ -221,6 +218,8 @@ import sun.swing.PrintingStatus; /* The first versions of the JTable, contained in Swing-0.1 through * Swing-0.4, were written by Alan Chung. */ +@JavaBean(defaultProperty = "UI", description = "A component which displays data in a two dimensional grid.") +@SwingContainer(false) @SuppressWarnings("serial") // Same-version serialization only public class JTable extends JComponent implements TableModelListener, Scrollable, TableColumnModelListener, ListSelectionListener, CellEditorListener, @@ -894,10 +893,9 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * * @param tableHeader new tableHeader * @see #getTableHeader - * @beaninfo - * bound: true - * description: The JTableHeader instance which renders the column headers. */ + @BeanProperty(description + = "The JTableHeader instance which renders the column headers.") public void setTableHeader(JTableHeader tableHeader) { if (this.tableHeader != tableHeader) { JTableHeader old = this.tableHeader; @@ -933,10 +931,9 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * @exception IllegalArgumentException if rowHeight is * less than 1 * @see #getRowHeight - * @beaninfo - * bound: true - * description: The height of the specified row. */ + @BeanProperty(description + = "The height of the specified row.") public void setRowHeight(int rowHeight) { if (rowHeight <= 0) { throw new IllegalArgumentException("New row height less than 1"); @@ -979,11 +976,10 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * @param rowHeight new row height, in pixels * @exception IllegalArgumentException if rowHeight is * less than 1 - * @beaninfo - * bound: true - * description: The height in pixels of the cells in row * @since 1.3 */ + @BeanProperty(description + = "The height in pixels of the cells in row") public void setRowHeight(int row, int rowHeight) { if (rowHeight <= 0) { throw new IllegalArgumentException("New row height less than 1"); @@ -1010,10 +1006,9 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * * @param rowMargin the number of pixels between cells in a row * @see #getRowMargin - * @beaninfo - * bound: true - * description: The amount of space between cells. */ + @BeanProperty(description + = "The amount of space between cells.") public void setRowMargin(int rowMargin) { int old = this.rowMargin; this.rowMargin = rowMargin; @@ -1041,10 +1036,9 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * specifying the new width * and height between cells * @see #getIntercellSpacing - * @beaninfo - * description: The spacing between the cells, - * drawn in the background color of the JTable. */ + @BeanProperty(bound = false, description + = "The spacing between the cells, drawn in the background color of the JTable.") public void setIntercellSpacing(Dimension intercellSpacing) { // Set the rowMargin here and columnMargin in the TableColumnModel setRowMargin(intercellSpacing.height); @@ -1071,10 +1065,9 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * @param gridColor the new color of the grid lines * @exception IllegalArgumentException if gridColor is null * @see #getGridColor - * @beaninfo - * bound: true - * description: The grid color. */ + @BeanProperty(description + = "The grid color.") public void setGridColor(Color gridColor) { if (gridColor == null) { throw new IllegalArgumentException("New color is null"); @@ -1108,9 +1101,9 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * * @see #setShowVerticalLines * @see #setShowHorizontalLines - * @beaninfo - * description: The color used to draw the grid lines. */ + @BeanProperty(description + = "The color used to draw the grid lines.") public void setShowGrid(boolean showGrid) { setShowHorizontalLines(showGrid); setShowVerticalLines(showGrid); @@ -1127,10 +1120,9 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * @see #getShowHorizontalLines * @see #setShowGrid * @see #setShowVerticalLines - * @beaninfo - * bound: true - * description: Whether horizontal lines should be drawn in between the cells. */ + @BeanProperty(description + = "Whether horizontal lines should be drawn in between the cells.") public void setShowHorizontalLines(boolean showHorizontalLines) { boolean old = this.showHorizontalLines; this.showHorizontalLines = showHorizontalLines; @@ -1148,10 +1140,9 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * @see #getShowVerticalLines * @see #setShowGrid * @see #setShowHorizontalLines - * @beaninfo - * bound: true - * description: Whether vertical lines should be drawn in between the cells. */ + @BeanProperty(description + = "Whether vertical lines should be drawn in between the cells.") public void setShowVerticalLines(boolean showVerticalLines) { boolean old = this.showVerticalLines; this.showVerticalLines = showVerticalLines; @@ -1198,15 +1189,14 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * * @see #getAutoResizeMode * @see #doLayout - * @beaninfo - * bound: true - * description: Whether the columns should adjust themselves automatically. - * enum: AUTO_RESIZE_OFF JTable.AUTO_RESIZE_OFF - * AUTO_RESIZE_NEXT_COLUMN JTable.AUTO_RESIZE_NEXT_COLUMN - * AUTO_RESIZE_SUBSEQUENT_COLUMNS JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS - * AUTO_RESIZE_LAST_COLUMN JTable.AUTO_RESIZE_LAST_COLUMN - * AUTO_RESIZE_ALL_COLUMNS JTable.AUTO_RESIZE_ALL_COLUMNS */ + @BeanProperty(enumerationValues = { + "JTable.AUTO_RESIZE_OFF", + "JTable.AUTO_RESIZE_NEXT_COLUMN", + "JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS", + "JTable.AUTO_RESIZE_LAST_COLUMN", + "JTable.AUTO_RESIZE_ALL_COLUMNS"}, description + = "Whether the columns should adjust themselves automatically.") public void setAutoResizeMode(int mode) { if (isValidAutoResizeMode(mode)) { int old = autoResizeMode; @@ -1248,10 +1238,9 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * @param autoCreateColumnsFromModel true if JTable should automatically create columns * @see #getAutoCreateColumnsFromModel * @see #createDefaultColumnsFromModel - * @beaninfo - * bound: true - * description: Automatically populates the columnModel when a new TableModel is submitted. */ + @BeanProperty(description + = "Automatically populates the columnModel when a new TableModel is submitted.") public void setAutoCreateColumnsFromModel(boolean autoCreateColumnsFromModel) { if (this.autoCreateColumnsFromModel != autoCreateColumnsFromModel) { boolean old = this.autoCreateColumnsFromModel; @@ -1442,11 +1431,9 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * @see #setTransferHandler * @see TransferHandler * @since 1.4 - * - * @beaninfo - * description: determines whether automatic drag handling is enabled - * bound: false */ + @BeanProperty(bound = false, description + = "determines whether automatic drag handling is enabled") public void setDragEnabled(boolean b) { checkDragEnabled(b); dragEnabled = b; @@ -1834,6 +1821,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * @see TransferHandler#canImport(TransferHandler.TransferSupport) * @since 1.6 */ + @BeanProperty(bound = false) public final DropLocation getDropLocation() { return dropLocation; } @@ -1853,12 +1841,10 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * @param autoCreateRowSorter whether or not a {@code RowSorter} * should be automatically created * @see javax.swing.table.TableRowSorter - * @beaninfo - * bound: true - * preferred: true - * description: Whether or not to turn on sorting by default. * @since 1.6 */ + @BeanProperty(preferred = true, description + = "Whether or not to turn on sorting by default.") public void setAutoCreateRowSorter(boolean autoCreateRowSorter) { boolean oldValue = this.autoCreateRowSorter; this.autoCreateRowSorter = autoCreateRowSorter; @@ -1889,12 +1875,10 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * is true. * * @param update whether or not to update the selection on sorting - * @beaninfo - * bound: true - * expert: true - * description: Whether or not to update the selection on sorting * @since 1.6 */ + @BeanProperty(expert = true, description + = "Whether or not to update the selection on sorting") public void setUpdateSelectionOnSort(boolean update) { if (updateSelectionOnSort != update) { updateSelectionOnSort = update; @@ -1929,11 +1913,10 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * @param sorter the RowSorter; null turns * sorting off * @see javax.swing.table.TableRowSorter - * @beaninfo - * bound: true - * description: The table's RowSorter * @since 1.6 */ + @BeanProperty(description + = "The table's RowSorter") public void setRowSorter(RowSorter sorter) { RowSorter oldRowSorter = null; if (sortManager != null) { @@ -1985,12 +1968,12 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * * @param selectionMode the mode used by the row and column selection models * @see JList#setSelectionMode - * @beaninfo - * description: The selection mode used by the row and column selection models. - * enum: SINGLE_SELECTION ListSelectionModel.SINGLE_SELECTION - * SINGLE_INTERVAL_SELECTION ListSelectionModel.SINGLE_INTERVAL_SELECTION - * MULTIPLE_INTERVAL_SELECTION ListSelectionModel.MULTIPLE_INTERVAL_SELECTION */ + @BeanProperty(enumerationValues = { + "ListSelectionModel.SINGLE_SELECTION", + "ListSelectionModel.SINGLE_INTERVAL_SELECTION", + "ListSelectionModel.MULTIPLE_INTERVAL_SELECTION"}, description + = "The selection mode used by the row and column selection models.") public void setSelectionMode(int selectionMode) { clearSelection(); getSelectionModel().setSelectionMode(selectionMode); @@ -2002,11 +1985,9 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * * @param rowSelectionAllowed true if this model will allow row selection * @see #getRowSelectionAllowed - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: If true, an entire row is selected for each selected cell. */ + @BeanProperty(visualUpdate = true, description + = "If true, an entire row is selected for each selected cell.") public void setRowSelectionAllowed(boolean rowSelectionAllowed) { boolean old = this.rowSelectionAllowed; this.rowSelectionAllowed = rowSelectionAllowed; @@ -2031,11 +2012,9 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * * @param columnSelectionAllowed true if this model will allow column selection * @see #getColumnSelectionAllowed - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: If true, an entire column is selected for each selected cell. */ + @BeanProperty(visualUpdate = true, description + = "If true, an entire column is selected for each selected cell.") public void setColumnSelectionAllowed(boolean columnSelectionAllowed) { boolean old = columnModel.getColumnSelectionAllowed(); columnModel.setColumnSelectionAllowed(columnSelectionAllowed); @@ -2069,12 +2048,9 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * selection is allowed * @see #getCellSelectionEnabled * @see #isCellSelected - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: Select a rectangular region of cells rather than - * rows or columns. */ + @BeanProperty(visualUpdate = true, description + = "Select a rectangular region of cells rather than rows or columns.") public void setCellSelectionEnabled(boolean cellSelectionEnabled) { setRowSelectionAllowed(cellSelectionEnabled); setColumnSelectionAllowed(cellSelectionEnabled); @@ -2262,6 +2238,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * Returns the index of the first selected row, -1 if no row is selected. * @return the index of the first selected row */ + @BeanProperty(bound = false) public int getSelectedRow() { return selectionModel.getMinSelectionIndex(); } @@ -2271,6 +2248,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * -1 if no column is selected. * @return the index of the first selected column */ + @BeanProperty(bound = false) public int getSelectedColumn() { return columnModel.getSelectionModel().getMinSelectionIndex(); } @@ -2282,6 +2260,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * or an empty array if no row is selected * @see #getSelectedRow */ + @BeanProperty(bound = false) public int[] getSelectedRows() { int iMin = selectionModel.getMinSelectionIndex(); int iMax = selectionModel.getMaxSelectionIndex(); @@ -2309,6 +2288,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * or an empty array if no column is selected * @see #getSelectedColumn */ + @BeanProperty(bound = false) public int[] getSelectedColumns() { return columnModel.getSelectedColumns(); } @@ -2318,6 +2298,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * * @return the number of selected rows, 0 if no rows are selected */ + @BeanProperty(bound = false) public int getSelectedRowCount() { int iMin = selectionModel.getMinSelectionIndex(); int iMax = selectionModel.getMaxSelectionIndex(); @@ -2336,6 +2317,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * * @return the number of selected columns, 0 if no columns are selected */ + @BeanProperty(bound = false) public int getSelectedColumnCount() { return columnModel.getSelectedColumnCount(); } @@ -2523,10 +2505,9 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * @see #setForeground * @see #setBackground * @see #setFont - * @beaninfo - * bound: true - * description: A default foreground color for selected cells. */ + @BeanProperty(description + = "A default foreground color for selected cells.") public void setSelectionForeground(Color selectionForeground) { Color old = this.selectionForeground; this.selectionForeground = selectionForeground; @@ -2561,10 +2542,9 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * @see #setForeground * @see #setBackground * @see #setFont - * @beaninfo - * bound: true - * description: A default background color for selected cells. */ + @BeanProperty(description + = "A default background color for selected cells.") public void setSelectionBackground(Color selectionBackground) { Color old = this.selectionBackground; this.selectionBackground = selectionBackground; @@ -2680,6 +2660,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * @return the number of rows shown in the JTable * @see #getColumnCount */ + @BeanProperty(bound = false) public int getRowCount() { RowSorter sorter = getRowSorter(); if (sorter != null) { @@ -2696,6 +2677,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * @see #getRowCount * @see #removeColumn */ + @BeanProperty(bound = false) public int getColumnCount() { return getColumnModel().getColumnCount(); } @@ -3564,6 +3546,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * @see #editingColumn * @see #editingRow */ + @BeanProperty(bound = false) public boolean isEditing() { return cellEditor != null; } @@ -3574,6 +3557,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * * @return Component handling editing session */ + @BeanProperty(bound = false) public Component getEditorComponent() { return editorComp; } @@ -3620,12 +3604,9 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * * @param ui the TableUI L&F object * @see UIDefaults#getUI - * @beaninfo - * bound: true - * hidden: true - * attribute: visualUpdate true - * description: The UI object that implements the Component's LookAndFeel. */ + @BeanProperty(hidden = true, visualUpdate = true, description + = "The UI object that implements the Component's LookAndFeel.") public void setUI(TableUI ui) { if (this.ui != ui) { super.setUI(ui); @@ -3681,6 +3662,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; } @@ -3697,10 +3679,9 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * @param dataModel the new data source for this table * @throws IllegalArgumentException if {@code dataModel} is {@code null} * @see #getModel - * @beaninfo - * bound: true - * description: The model that is the source of the data for this view. */ + @BeanProperty(description + = "The model that is the source of the data for this view.") public void setModel(final TableModel dataModel) { if (dataModel == null) { throw new IllegalArgumentException("Cannot set a null TableModel"); @@ -3743,10 +3724,9 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * @param columnModel the new data source for this table * @throws IllegalArgumentException if {@code columnModel} is {@code null} * @see #getColumnModel - * @beaninfo - * bound: true - * description: The object governing the way columns appear in the view. */ + @BeanProperty(description + = "The object governing the way columns appear in the view.") public void setColumnModel(final TableColumnModel columnModel) { if (columnModel == null) { throw new IllegalArgumentException("Cannot set a null ColumnModel"); @@ -3788,10 +3768,9 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * @throws IllegalArgumentException if {@code selectionModel} is * {@code null} * @see #getSelectionModel - * @beaninfo - * bound: true - * description: The selection model for rows. */ + @BeanProperty(description + = "The selection model for rows.") public void setSelectionModel(final ListSelectionModel selectionModel) { if (selectionModel == null) { throw new IllegalArgumentException("Cannot set a null SelectionModel"); @@ -4784,9 +4763,9 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * @param size a Dimension object specifying the preferredSize of a * JViewport whose view is this table * @see Scrollable#getPreferredScrollableViewportSize - * @beaninfo - * description: The preferred size of the viewport. */ + @BeanProperty(bound = false, description + = "The preferred size of the viewport.") public void setPreferredScrollableViewportSize(Dimension size) { preferredViewportSize = size; } @@ -5222,6 +5201,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * to AUTO_RESIZE_OFF, otherwise returns true * @see Scrollable#getScrollableTracksViewportWidth */ + @BeanProperty(bound = false) public boolean getScrollableTracksViewportWidth() { return !(autoResizeMode == AUTO_RESIZE_OFF); } @@ -5239,6 +5219,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * @see #setFillsViewportHeight * @see #getFillsViewportHeight */ + @BeanProperty(bound = false) public boolean getScrollableTracksViewportHeight() { Container parent = SwingUtilities.getUnwrappedParent(this); return getFillsViewportHeight() @@ -5260,11 +5241,9 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * @see #getFillsViewportHeight * @see #getScrollableTracksViewportHeight * @since 1.6 - * @beaninfo - * bound: true - * description: Whether or not this table is always made large enough - * to fill the height of an enclosing viewport */ + @BeanProperty(description + = "Whether or not this table is always made large enough to fill the height of an enclosing viewport") public void setFillsViewportHeight(boolean fillsViewportHeight) { boolean old = this.fillsViewportHeight; this.fillsViewportHeight = fillsViewportHeight; @@ -5661,10 +5640,9 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * * @param anEditor the active cell editor * @see #cellEditor - * @beaninfo - * bound: true - * description: The table's active cell editor. */ + @BeanProperty(description + = "The table's active cell editor.") public void setCellEditor(TableCellEditor anEditor) { TableCellEditor oldEditor = cellEditor; cellEditor = anEditor; @@ -6656,6 +6634,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable * @return an AccessibleJTable that serves as the * AccessibleContext of this JTable */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJTable(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JTextArea.java b/jdk/src/java.desktop/share/classes/javax/swing/JTextArea.java index 48b586e8ca0..d64fa02721b 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JTextArea.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JTextArea.java @@ -25,17 +25,12 @@ package javax.swing; import java.awt.*; -import java.awt.event.*; +import java.beans.JavaBean; +import java.beans.BeanProperty; import javax.swing.text.*; -import javax.swing.plaf.*; import javax.accessibility.*; -import java.util.Collections; -import java.util.Set; -import java.util.StringTokenizer; - import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; import java.io.IOException; /** @@ -116,15 +111,13 @@ import java.io.IOException; * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. * - * @beaninfo - * attribute: isContainer false - * description: A multi-line area that displays plain text. - * * @author Timothy Prinzing * @see JTextPane * @see JEditorPane * @since 1.2 */ +@JavaBean(defaultProperty = "UIClassID", description = "A multi-line area that displays plain text.") +@SwingContainer(false) @SuppressWarnings("serial") // Same-version serialization only public class JTextArea extends JTextComponent { @@ -237,6 +230,7 @@ public class JTextArea extends JTextComponent { * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; } @@ -260,11 +254,9 @@ public class JTextArea extends JTextComponent { * * @param size number of characters to expand to * @see #getTabSize - * @beaninfo - * preferred: true - * bound: true - * description: the number of characters to expand tabs to */ + @BeanProperty(preferred = true, description + = "the number of characters to expand tabs to") public void setTabSize(int size) { Document doc = getDocument(); if (doc != null) { @@ -302,11 +294,9 @@ public class JTextArea extends JTextComponent { * * @param wrap indicates if lines should be wrapped * @see #getLineWrap - * @beaninfo - * preferred: true - * bound: true - * description: should lines be wrapped */ + @BeanProperty(preferred = true, description + = "should lines be wrapped") public void setLineWrap(boolean wrap) { boolean old = this.wrap; this.wrap = wrap; @@ -336,11 +326,9 @@ public class JTextArea extends JTextComponent { * @param word indicates if word boundaries should be used * for line wrapping * @see #getWrapStyleWord - * @beaninfo - * preferred: false - * bound: true - * description: should wrapping occur at word boundaries */ + @BeanProperty(description + = "should wrapping occur at word boundaries") public void setWrapStyleWord(boolean word) { boolean old = this.word; this.word = word; @@ -388,6 +376,7 @@ public class JTextArea extends JTextComponent { * * @return the number of lines > 0 */ + @BeanProperty(bound = false) public int getLineCount() { Element map = getDocument().getDefaultRootElement(); return map.getElementCount(); @@ -531,9 +520,9 @@ public class JTextArea extends JTextComponent { * @param rows the number of rows >= 0 * @exception IllegalArgumentException if rows is less than 0 * @see #getRows - * @beaninfo - * description: the number of rows preferred for display */ + @BeanProperty(bound = false, description + = "the number of rows preferred for display") public void setRows(int rows) { int oldVal = this.rows; if (rows < 0) { @@ -575,9 +564,9 @@ public class JTextArea extends JTextComponent { * @param columns the number of columns >= 0 * @exception IllegalArgumentException if columns is less than 0 * @see #getColumns - * @beaninfo - * description: the number of columns preferred for display */ + @BeanProperty(bound = false, description + = "the number of columns preferred for display") public void setColumns(int columns) { int oldVal = this.columns; if (columns < 0) { @@ -680,6 +669,7 @@ public class JTextArea extends JTextComponent { * @return true if a viewport should force the Scrollables width * to match its own. */ + @BeanProperty(bound = false) public boolean getScrollableTracksViewportWidth() { return (wrap) ? true : super.getScrollableTracksViewportWidth(); } @@ -693,6 +683,7 @@ public class JTextArea extends JTextComponent { * @return The preferredSize of a JViewport whose view is this Scrollable. * @see JViewport#getPreferredSize */ + @BeanProperty(bound = false) public Dimension getPreferredScrollableViewportSize() { Dimension size = super.getPreferredScrollableViewportSize(); size = (size == null) ? new Dimension(400,400) : size; @@ -766,6 +757,7 @@ public class JTextArea extends JTextComponent { * @return an AccessibleJTextArea that serves as the * AccessibleContext of this JTextArea */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJTextArea(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JTextField.java b/jdk/src/java.desktop/share/classes/javax/swing/JTextField.java index 94290052870..d3ec0dad46b 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JTextField.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JTextField.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,18 +24,17 @@ */ package javax.swing; -import sun.swing.SwingUtilities2; - import java.awt.*; import java.awt.event.*; -import java.beans.*; +import java.beans.JavaBean; +import java.beans.BeanProperty; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; import javax.swing.text.*; -import javax.swing.plaf.*; import javax.swing.event.*; import javax.accessibility.*; import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; import java.io.IOException; import java.io.Serializable; @@ -152,16 +151,14 @@ import java.io.Serializable; * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. * - * @beaninfo - * attribute: isContainer false - * description: A component which allows for the editing of a single line of text. - * * @author Timothy Prinzing * @see #setActionCommand * @see JPasswordField * @see #addActionListener * @since 1.2 */ +@JavaBean(defaultProperty = "UIClassID", description = "A component which allows for the editing of a single line of text.") +@SwingContainer(false) @SuppressWarnings("serial") // Same-version serialization only public class JTextField extends JTextComponent implements SwingConstants { @@ -253,6 +250,7 @@ public class JTextField extends JTextComponent implements SwingConstants { * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; } @@ -266,11 +264,9 @@ public class JTextField extends JTextComponent implements SwingConstants { * * @param doc the document to display/edit * @see #getDocument - * @beaninfo - * description: the text document model - * bound: true - * expert: true */ + @BeanProperty(expert = true, description + = "the text document model") public void setDocument(Document doc) { if (doc != null) { doc.putProperty("filterNewlines", Boolean.TRUE); @@ -332,14 +328,14 @@ public class JTextField extends JTextComponent implements SwingConstants { * @param alignment the alignment * @exception IllegalArgumentException if alignment * is not a valid key - * @beaninfo - * preferred: true - * bound: true - * description: Set the field alignment to LEFT, CENTER, RIGHT, - * LEADING (the default) or TRAILING - * enum: LEFT JTextField.LEFT CENTER JTextField.CENTER RIGHT JTextField.RIGHT - * LEADING JTextField.LEADING TRAILING JTextField.TRAILING */ + @BeanProperty(preferred = true, enumerationValues = { + "JTextField.LEFT", + "JTextField.CENTER", + "JTextField.RIGHT", + "JTextField.LEADING", + "JTextField.TRAILING"}, description + = "Set the field alignment to LEFT, CENTER, RIGHT, LEADING (the default) or TRAILING") public void setHorizontalAlignment(int alignment) { if (alignment == horizontalAlignment) return; int oldValue = horizontalAlignment; @@ -382,9 +378,9 @@ public class JTextField extends JTextComponent implements SwingConstants { * @param columns the number of columns >= 0 * @exception IllegalArgumentException if columns * is less than 0 - * @beaninfo - * description: the number of columns preferred for display */ + @BeanProperty(bound = false, description + = "the number of columns preferred for display") public void setColumns(int columns) { int oldVal = this.columns; if (columns < 0) { @@ -476,6 +472,7 @@ public class JTextField extends JTextComponent implements SwingConstants { * array if no listeners have been added * @since 1.4 */ + @BeanProperty(bound = false) public synchronized ActionListener[] getActionListeners() { return listenerList.getListeners(ActionListener.class); } @@ -559,11 +556,9 @@ public class JTextField extends JTextComponent implements SwingConstants { * @see #configurePropertiesFromAction * @see #createActionPropertyChangeListener * @see #actionPropertyChanged - * @beaninfo - * bound: true - * attribute: visualUpdate true - * description: the Action instance connected with this ActionEvent source */ + @BeanProperty(visualUpdate = true, description + = "the Action instance connected with this ActionEvent source") public void setAction(Action a) { Action oldValue = getAction(); if (action==null || !action.equals(a)) { @@ -712,6 +707,7 @@ public class JTextField extends JTextComponent implements SwingConstants { * * @return the command list */ + @BeanProperty(bound = false) public Action[] getActions() { return TextAction.augmentList(super.getActions(), defaultActions); } @@ -742,6 +738,7 @@ public class JTextField extends JTextComponent implements SwingConstants { * @return the visibility * @see BoundedRangeModel */ + @BeanProperty(bound = false) public BoundedRangeModel getHorizontalVisibility() { return visibility; } @@ -926,6 +923,7 @@ public class JTextField extends JTextComponent implements SwingConstants { * @return an AccessibleJTextField that serves as the * AccessibleContext of this JTextField */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJTextField(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JTextPane.java b/jdk/src/java.desktop/share/classes/javax/swing/JTextPane.java index f9c2de42a65..e5ef17b27d0 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JTextPane.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JTextPane.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,15 +25,12 @@ package javax.swing; import java.awt.*; -import java.awt.event.ActionEvent; - +import java.beans.JavaBean; +import java.beans.BeanProperty; import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; import java.io.IOException; import javax.swing.text.*; -import javax.swing.event.*; -import javax.swing.plaf.*; /** * A text component that can be marked up with attributes that are @@ -72,14 +69,12 @@ import javax.swing.plaf.*; * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. * - * @beaninfo - * attribute: isContainer true - * description: A text component that can be marked up with attributes that are graphically represented. - * * @author Timothy Prinzing * @see javax.swing.text.StyledEditorKit * @since 1.2 */ +@JavaBean(description = "A text component that can be marked up with attributes that are graphically represented.") +@SwingContainer @SuppressWarnings("serial") // Same-version serialization only public class JTextPane extends JEditorPane { @@ -120,6 +115,7 @@ public class JTextPane extends JEditorPane { * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; } @@ -338,6 +334,7 @@ public class JTextPane extends JEditorPane { * * @return the attributes, or null */ + @BeanProperty(bound = false) public AttributeSet getCharacterAttributes() { StyledDocument doc = getStyledDocument(); Element run = doc.getCharacterElement(getCaretPosition()); @@ -379,6 +376,7 @@ public class JTextPane extends JEditorPane { * * @return the attributes */ + @BeanProperty(bound = false) public AttributeSet getParagraphAttributes() { StyledDocument doc = getStyledDocument(); Element paragraph = doc.getParagraphElement(getCaretPosition()); @@ -410,6 +408,7 @@ public class JTextPane extends JEditorPane { * * @return the attributes */ + @BeanProperty(bound = false) public MutableAttributeSet getInputAttributes() { return getStyledEditorKit().getInputAttributes(); } diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JToggleButton.java b/jdk/src/java.desktop/share/classes/javax/swing/JToggleButton.java index 08ec0be8659..da9387e3061 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JToggleButton.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JToggleButton.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,16 +26,15 @@ package javax.swing; import java.awt.*; import java.awt.event.*; +import java.beans.JavaBean; +import java.beans.BeanProperty; -import javax.swing.event.*; import javax.swing.plaf.*; import javax.accessibility.*; import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; import java.io.IOException; - /** * An implementation of a two-state button. * The JRadioButton and JCheckBox classes @@ -68,15 +67,13 @@ import java.io.IOException; * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. * - * @beaninfo - * attribute: isContainer false - * description: An implementation of a two-state button. - * * @see JRadioButton * @see JCheckBox * @author Jeff Dinkins * @since 1.2 */ +@JavaBean(defaultProperty = "UIClassID", description = "An implementation of a two-state button.") +@SwingContainer(false) @SuppressWarnings("serial") // Same-version serialization only public class JToggleButton extends AbstractButton implements Accessible { @@ -195,9 +192,9 @@ public class JToggleButton extends AbstractButton implements Accessible { * @return String "ToggleButtonUI" * @see JComponent#getUIClassID * @see UIDefaults#getUI - * @beaninfo - * description: A string that specifies the name of the L&F class */ + @BeanProperty(bound = false, description + = "A string that specifies the name of the L&F class") public String getUIClassID() { return uiClassID; } @@ -362,10 +359,9 @@ public class JToggleButton extends AbstractButton implements Accessible { * * @return an AccessibleJToggleButton that serves as the * AccessibleContext of this JToggleButton - * @beaninfo - * expert: true - * description: The AccessibleContext associated with this ToggleButton. */ + @BeanProperty(bound = false, expert = true, description + = "The AccessibleContext associated with this ToggleButton.") public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJToggleButton(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JToolBar.java b/jdk/src/java.desktop/share/classes/javax/swing/JToolBar.java index 0a7e6fef71d..f13e5c41161 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JToolBar.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JToolBar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,31 +22,26 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ - package javax.swing; -import java.awt.Color; import java.awt.Component; -import java.awt.ComponentOrientation; import java.awt.Container; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Insets; import java.awt.LayoutManager; import java.awt.LayoutManager2; -import java.awt.event.*; -import java.beans.*; +import java.beans.JavaBean; +import java.beans.BeanProperty; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; -import javax.swing.border.Border; import javax.swing.plaf.*; import javax.accessibility.*; import java.io.Serializable; import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; import java.io.IOException; -import java.util.Hashtable; - /** * JToolBar provides a component that is useful for @@ -78,15 +73,13 @@ import java.util.Hashtable; * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. * - * @beaninfo - * attribute: isContainer true - * description: A component which displays commonly used controls or Actions. - * * @author Georges Saab * @author Jeff Shapiro * @see Action * @since 1.2 */ +@JavaBean(defaultProperty = "UI", description = "A component which displays commonly used controls or Actions.") +@SwingContainer @SuppressWarnings("serial") // Same-version serialization only public class JToolBar extends JComponent implements SwingConstants, Accessible { @@ -175,12 +168,9 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible * * @param ui the ToolBarUI L&F object * @see UIDefaults#getUI - * @beaninfo - * bound: true - * hidden: true - * attribute: visualUpdate true - * description: The UI object that implements the Component's LookAndFeel. */ + @BeanProperty(hidden = true, visualUpdate = true, description + = "The UI object that implements the Component's LookAndFeel.") public void setUI(ToolBarUI ui) { super.setUI(ui); } @@ -212,6 +202,7 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; } @@ -266,11 +257,9 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible * @param m an Insets object that defines the space * between the border and the buttons * @see Insets - * @beaninfo - * description: The margin between the tool bar's border and contents - * bound: true - * expert: true */ + @BeanProperty(expert = true, description + = "The margin between the tool bar's border and contents") public void setMargin(Insets m) { Insets old = margin; @@ -317,11 +306,9 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible * * @param b if true, the border is painted * @see #isBorderPainted - * @beaninfo - * description: Does the tool bar paint its borders? - * bound: true - * expert: true */ + @BeanProperty(expert = true, description + = "Does the tool bar paint its borders?") public void setBorderPainted(boolean b) { if ( paintBorder != b ) @@ -376,11 +363,9 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible * @param b if true, the tool bar can be moved; * false otherwise * @see #isFloatable - * @beaninfo - * description: Can the tool bar be made to float by the user? - * bound: true - * preferred: true */ + @BeanProperty(preferred = true, description + = "Can the tool bar be made to float by the user?") public void setFloatable( boolean b ) { if ( floatable != b ) @@ -418,13 +403,11 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible * @exception IllegalArgumentException if orientation is neither * HORIZONTAL nor VERTICAL * @see #getOrientation - * @beaninfo - * description: The current orientation of the tool bar - * bound: true - * preferred: true - * enum: HORIZONTAL SwingConstants.HORIZONTAL - * VERTICAL SwingConstants.VERTICAL */ + @BeanProperty(preferred = true, enumerationValues = { + "SwingConstants.HORIZONTAL", + "SwingConstants.VERTICAL"}, description + = "The current orientation of the tool bar") public void setOrientation( int o ) { checkOrientation( o ); @@ -451,12 +434,9 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible * * @param rollover true for rollover toolbar buttons; otherwise false * @since 1.4 - * @beaninfo - * bound: true - * preferred: true - * attribute: visualUpdate true - * description: Will draw rollover button borders in the toolbar. */ + @BeanProperty(preferred = true, visualUpdate = true, description + = "Will draw rollover button borders in the toolbar.") public void setRollover(boolean rollover) { putClientProperty("JToolBar.isRollover", rollover ? Boolean.TRUE : Boolean.FALSE); @@ -836,6 +816,7 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible * @return an AccessibleJToolBar that serves as the * AccessibleContext of this JToolBar */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJToolBar(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JToolTip.java b/jdk/src/java.desktop/share/classes/javax/swing/JToolTip.java index dad092dc5fd..7d2ac8c6ad8 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JToolTip.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JToolTip.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,11 @@ package javax.swing; + import javax.swing.plaf.*; import javax.accessibility.*; +import java.beans.BeanProperty; import java.io.ObjectOutputStream; import java.io.ObjectInputStream; import java.io.IOException; @@ -121,11 +123,9 @@ public class JToolTip extends JComponent implements Accessible { * The string tipText may be null. * * @param tipText the String to display - * @beaninfo - * preferred: true - * bound: true - * description: Sets the text of the tooltip */ + @BeanProperty(preferred = true, description + = "Sets the text of the tooltip") public void setTipText(String tipText) { String oldValue = this.tipText; this.tipText = tipText; @@ -156,10 +156,9 @@ public class JToolTip extends JComponent implements Accessible { * * @param c the JComponent being described * @see JComponent#createToolTip - * @beaninfo - * bound: true - * description: Sets the component that the tooltip describes. */ + @BeanProperty(description + = "Sets the component that the tooltip describes.") public void setComponent(JComponent c) { JComponent oldValue = this.component; diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JTree.java b/jdk/src/java.desktop/share/classes/javax/swing/JTree.java index 9d58f86ea09..a46217fa64d 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JTree.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JTree.java @@ -22,12 +22,15 @@ * 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.*; +import java.beans.JavaBean; +import java.beans.BeanProperty; +import java.beans.ConstructorProperties; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; import java.io.*; import java.util.*; import javax.swing.event.*; @@ -35,11 +38,11 @@ import javax.swing.plaf.*; import javax.swing.tree.*; import javax.swing.text.Position; import javax.accessibility.*; + import sun.swing.SwingUtilities2; import sun.swing.SwingUtilities2.Section; import static sun.swing.SwingUtilities2.Section.*; - /** * * A control that displays a set of hierarchical data as an outline. @@ -134,15 +137,14 @@ import static sun.swing.SwingUtilities2.Section.*; * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. *

    - * @beaninfo - * attribute: isContainer false - * description: A component that displays a set of hierarchical data as an outline. * * @author Rob Davis * @author Ray Ryan * @author Scott Violet * @since 1.2 */ +@JavaBean(defaultProperty = "UI", description = "A component that displays a set of hierarchical data as an outline.") +@SwingContainer(false) @SuppressWarnings("serial") public class JTree extends JComponent implements Scrollable, Accessible { @@ -687,12 +689,9 @@ public class JTree extends JComponent implements Scrollable, Accessible * * @param ui the TreeUI L&F object * @see UIDefaults#getUI - * @beaninfo - * bound: true - * hidden: true - * attribute: visualUpdate true - * description: The UI object that implements the Component's LookAndFeel. */ + @BeanProperty(hidden = true, visualUpdate = true, description + = "The UI object that implements the Component's LookAndFeel.") public void setUI(TreeUI ui) { if (this.ui != ui) { settingUI = true; @@ -728,6 +727,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; } @@ -750,11 +750,9 @@ public class JTree extends JComponent implements Scrollable, Accessible * This is a bound property. * * @param x the TreeCellRenderer that is to render each cell - * @beaninfo - * bound: true - * description: The TreeCellRenderer that will be used to draw - * each cell. */ + @BeanProperty(description + = "The TreeCellRenderer that will be used to draw each cell.") public void setCellRenderer(TreeCellRenderer x) { TreeCellRenderer oldValue = cellRenderer; @@ -771,10 +769,9 @@ public class JTree extends JComponent implements Scrollable, Accessible * This is a bound property. * * @param flag a boolean value, true if the tree is editable - * @beaninfo - * bound: true - * description: Whether the tree is editable. */ + @BeanProperty(description + = "Whether the tree is editable.") public void setEditable(boolean flag) { boolean oldValue = this.editable; @@ -806,11 +803,9 @@ public class JTree extends JComponent implements Scrollable, Accessible * This is a bound property. * * @param cellEditor the TreeCellEditor to use - * @beaninfo - * bound: true - * description: The cell editor. A null value implies the tree - * cannot be edited. */ + @BeanProperty(description + = "The cell editor. A null value implies the tree cannot be edited.") public void setCellEditor(TreeCellEditor cellEditor) { TreeCellEditor oldEditor = this.cellEditor; @@ -844,10 +839,9 @@ public class JTree extends JComponent implements Scrollable, Accessible * This is a bound property. * * @param newModel the TreeModel that is to provide the data - * @beaninfo - * bound: true - * description: The TreeModel that will provide the data. */ + @BeanProperty(description + = "The TreeModel that will provide the data.") public void setModel(TreeModel newModel) { clearSelection(); @@ -903,11 +897,9 @@ public class JTree extends JComponent implements Scrollable, Accessible * * @param rootVisible true if the root node of the tree is to be displayed * @see #rootVisible - * @beaninfo - * bound: true - * description: Whether or not the root node - * from the TreeModel is visible. */ + @BeanProperty(description + = "Whether or not the root node from the TreeModel is visible.") public void setRootVisible(boolean rootVisible) { boolean oldValue = this.rootVisible; @@ -932,11 +924,9 @@ public class JTree extends JComponent implements Scrollable, Accessible * otherwise, false * @see #showsRootHandles * @see #getShowsRootHandles - * @beaninfo - * bound: true - * description: Whether the node handles are to be - * displayed. */ + @BeanProperty(description + = "Whether the node handles are to be displayed.") public void setShowsRootHandles(boolean newValue) { boolean oldValue = showsRootHandles; TreeModel model = getModel(); @@ -970,10 +960,9 @@ public class JTree extends JComponent implements Scrollable, Accessible * This is a bound property. * * @param rowHeight the height of each cell, in pixels - * @beaninfo - * bound: true - * description: The height of each cell. */ + @BeanProperty(description + = "The height of each cell.") public void setRowHeight(int rowHeight) { int oldValue = this.rowHeight; @@ -1001,6 +990,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * * @return true if the height of each row is a fixed size */ + @BeanProperty(bound = false) public boolean isFixedRowHeight() { return (rowHeight > 0); @@ -1015,11 +1005,9 @@ public class JTree extends JComponent implements Scrollable, Accessible * * @param newValue true to suggest a large model to the UI * @see #largeModel - * @beaninfo - * bound: true - * description: Whether the UI should use a - * large model. */ + @BeanProperty(description + = "Whether the UI should use a large model.") public void setLargeModel(boolean newValue) { boolean oldValue = largeModel; @@ -1048,12 +1036,10 @@ public class JTree extends JComponent implements Scrollable, Accessible * @param newValue true means that stopCellEditing is invoked * when editing is interrupted, and data is saved; false means that * cancelCellEditing is invoked, and changes are lost - * @beaninfo - * bound: true - * description: Determines what happens when editing is interrupted, - * selecting another node in the tree, a change in the - * tree's data, or some other means. */ + @BeanProperty(description + = "Determines what happens when editing is interrupted, selecting another node in the tree, " + + "a change in the tree's data, or some other means.") public void setInvokesStopCellEditing(boolean newValue) { boolean oldValue = invokesStopCellEditing; @@ -1090,11 +1076,9 @@ public class JTree extends JComponent implements Scrollable, Accessible * @param newValue false to disable scrolling on expansion; * true to enable it * @see #getScrollsOnExpand - * - * @beaninfo - * bound: true - * description: Indicates if a node descendant should be scrolled when expanded. */ + @BeanProperty(description + = "Indicates if a node descendant should be scrolled when expanded.") public void setScrollsOnExpand(boolean newValue) { boolean oldValue = scrollsOnExpand; @@ -1121,10 +1105,9 @@ public class JTree extends JComponent implements Scrollable, Accessible * * @param clickCount the number of mouse clicks to get a node expanded or closed * @since 1.3 - * @beaninfo - * bound: true - * description: Number of clicks before a node will expand/collapse. */ + @BeanProperty(description + = "Number of clicks before a node will expand/collapse.") public void setToggleClickCount(int clickCount) { int oldCount = toggleClickCount; @@ -1160,11 +1143,9 @@ public class JTree extends JComponent implements Scrollable, Accessible * @param newValue the new value for expandsSelectedPaths * * @since 1.3 - * @beaninfo - * bound: true - * description: Indicates whether changes to the selection should make - * the parent of the path visible. */ + @BeanProperty(description + = "Indicates whether changes to the selection should make the parent of the path visible.") public void setExpandsSelectedPaths(boolean newValue) { boolean oldValue = expandsSelectedPaths; @@ -1212,11 +1193,9 @@ public class JTree extends JComponent implements Scrollable, Accessible * @see #setTransferHandler * @see TransferHandler * @since 1.4 - * - * @beaninfo - * description: determines whether automatic drag handling is enabled - * bound: false */ + @BeanProperty(bound = false, description + = "determines whether automatic drag handling is enabled") public void setDragEnabled(boolean b) { checkDragEnabled(b); dragEnabled = b; @@ -1505,6 +1484,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * @see TransferHandler#canImport(TransferHandler.TransferSupport) * @since 1.6 */ + @BeanProperty(bound = false) public final DropLocation getDropLocation() { return dropLocation; } @@ -1635,6 +1615,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * * @return the number of viewable nodes */ + @BeanProperty(bound = false) public int getRowCount() { TreeUI tree = getUI(); @@ -1677,10 +1658,9 @@ public class JTree extends JComponent implements Scrollable, Accessible * * @param newPath the new lead path * @since 1.3 - * @beaninfo - * bound: true - * description: Lead selection path */ + @BeanProperty(description + = "Lead selection path") public void setLeadSelectionPath(TreePath newPath) { TreePath oldValue = leadPath; @@ -1705,10 +1685,9 @@ public class JTree extends JComponent implements Scrollable, Accessible * * @param newPath the new anchor path * @since 1.3 - * @beaninfo - * bound: true - * description: Anchor selection path */ + @BeanProperty(description + = "Anchor selection path") public void setAnchorSelectionPath(TreePath newPath) { TreePath oldValue = anchorPath; @@ -1828,6 +1807,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * null if nothing is selected * @see TreePath#getLastPathComponent */ + @BeanProperty(bound = false) public Object getLastSelectedPathComponent() { TreePath selPath = getSelectionModel().getSelectionPath(); @@ -1894,6 +1874,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * * @return the number of nodes selected */ + @BeanProperty(bound = false) public int getSelectionCount() { return selectionModel.getSelectionCount(); } @@ -1904,6 +1885,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * * @return the smallest selected row */ + @BeanProperty(bound = false) public int getMinSelectionRow() { return getSelectionModel().getMinSelectionRow(); } @@ -1914,6 +1896,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * * @return the largest selected row */ + @BeanProperty(bound = false) public int getMaxSelectionRow() { return getSelectionModel().getMaxSelectionRow(); } @@ -1925,6 +1908,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * where 0 is the first row in the display; or -1 * if leadPath is null */ + @BeanProperty(bound = false) public int getLeadSelectionRow() { TreePath leadPath = getLeadSelectionPath(); @@ -2198,6 +2182,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * null if row < 0 * or row >= getRowCount() */ + @BeanProperty(bound = false) public TreePath getPathForRow(int row) { TreeUI tree = getUI(); @@ -2368,6 +2353,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * @return true if the user is currently editing a node * @see #getSelectionPath */ + @BeanProperty(bound = false) public boolean isEditing() { TreeUI tree = getUI(); @@ -2430,6 +2416,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * * @return the TreePath for the node being edited */ + @BeanProperty(bound = false) public TreePath getEditingPath() { TreeUI tree = getUI(); @@ -2457,10 +2444,9 @@ public class JTree extends JComponent implements Scrollable, Accessible * @param selectionModel the TreeSelectionModel to use, * or null to disable selections * @see TreeSelectionModel - * @beaninfo - * bound: true - * description: The tree's selection model. */ + @BeanProperty(description + = "The tree's selection model.") public void setSelectionModel(TreeSelectionModel selectionModel) { if(selectionModel == null) selectionModel = EmptySelectionModel.sharedInstance(); @@ -2700,6 +2686,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * * @return true if the selection is currently empty */ + @BeanProperty(bound = false) public boolean isSelectionEmpty() { return getSelectionModel().isSelectionEmpty(); } @@ -2738,6 +2725,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * array if no listeners have been added * @since 1.4 */ + @BeanProperty(bound = false) public TreeExpansionListener[] getTreeExpansionListeners() { return listenerList.getListeners(TreeExpansionListener.class); } @@ -2770,6 +2758,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * array if no listeners have been added * @since 1.4 */ + @BeanProperty(bound = false) public TreeWillExpandListener[] getTreeWillExpandListeners() { return listenerList.getListeners(TreeWillExpandListener.class); } @@ -2929,6 +2918,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * array if no listeners have been added * @since 1.4 */ + @BeanProperty(bound = false) public TreeSelectionListener[] getTreeSelectionListeners() { return listenerList.getListeners(TreeSelectionListener.class); } @@ -2980,10 +2970,9 @@ public class JTree extends JComponent implements Scrollable, Accessible * This is a bound property. * * @param newCount the number of rows to display - * @beaninfo - * bound: true - * description: The number of rows that are to be displayed. */ + @BeanProperty(description + = "The number of rows that are to be displayed.") public void setVisibleRowCount(int newCount) { int oldCount = visibleRowCount; @@ -3459,6 +3448,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * * @return a Dimension object containing the preferred size */ + @BeanProperty(bound = false) public Dimension getPreferredScrollableViewportSize() { int width = getPreferredSize().width; int visRows = getVisibleRowCount(); @@ -3565,6 +3555,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * @return whether the tree should track the width of the viewport * @see Scrollable#getScrollableTracksViewportWidth */ + @BeanProperty(bound = false) public boolean getScrollableTracksViewportWidth() { Container parent = SwingUtilities.getUnwrappedParent(this); if (parent instanceof JViewport) { @@ -3582,6 +3573,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * @return whether the tree should track the height of the viewport * @see Scrollable#getScrollableTracksViewportHeight */ + @BeanProperty(bound = false) public boolean getScrollableTracksViewportHeight() { Container parent = SwingUtilities.getUnwrappedParent(this); if (parent instanceof JViewport) { @@ -4160,6 +4152,7 @@ public class JTree extends JComponent implements Scrollable, Accessible * @return an AccessibleJTree that serves as the * AccessibleContext of this JTree */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJTree(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JViewport.java b/jdk/src/java.desktop/share/classes/javax/swing/JViewport.java index 8090dc78087..d416dd7c39d 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JViewport.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JViewport.java @@ -28,6 +28,7 @@ package javax.swing; import java.awt.*; import java.awt.event.*; import java.awt.peer.ComponentPeer; +import java.beans.BeanProperty; import java.beans.Transient; import javax.swing.plaf.ViewportUI; @@ -300,13 +301,10 @@ public class JViewport extends JComponent implements Accessible * * @param ui the ViewportUI L&F object * @see UIDefaults#getUI - * @beaninfo - * bound: true - * hidden: true - * attribute: visualUpdate true - * description: The UI object that implements the Component's LookAndFeel. * @since 1.3 */ + @BeanProperty(hidden = true, visualUpdate = true, description + = "The UI object that implements the Component's LookAndFeel.") public void setUI(ViewportUI ui) { super.setUI(ui); } @@ -588,9 +586,8 @@ public class JViewport extends JComponent implements Accessible * @param insets the Insets object which can be reused * @return this viewports inset values * @see #getInsets - * @beaninfo - * expert: true */ + @BeanProperty(expert = true) public final Insets getInsets(Insets insets) { insets.left = insets.top = insets.right = insets.bottom = 0; return insets; @@ -861,15 +858,13 @@ public class JViewport extends JComponent implements Accessible * @see #BACKINGSTORE_SCROLL_MODE * @see #SIMPLE_SCROLL_MODE * - * @beaninfo - * bound: false - * description: Method of moving contents for incremental scrolls. - * enum: BLIT_SCROLL_MODE JViewport.BLIT_SCROLL_MODE - * BACKINGSTORE_SCROLL_MODE JViewport.BACKINGSTORE_SCROLL_MODE - * SIMPLE_SCROLL_MODE JViewport.SIMPLE_SCROLL_MODE - * * @since 1.3 */ + @BeanProperty(bound = false, enumerationValues = { + "JViewport.BLIT_SCROLL_MODE", + "JViewport.BACKINGSTORE_SCROLL_MODE", + "JViewport.SIMPLE_SCROLL_MODE"}, description + = "Method of moving contents for incremental scrolls.") public void setScrollMode(int mode) { scrollMode = mode; backingStore = mode == BACKINGSTORE_SCROLL_MODE; diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JWindow.java b/jdk/src/java.desktop/share/classes/javax/swing/JWindow.java index 804d4e3edc7..d25bad42691 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/JWindow.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/JWindow.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,10 +26,8 @@ package javax.swing; import java.awt.*; import java.awt.event.*; -import java.beans.PropertyChangeListener; -import java.util.Locale; -import java.util.Vector; -import java.io.Serializable; +import java.beans.JavaBean; +import java.beans.BeanProperty; import javax.accessibility.*; @@ -83,14 +81,11 @@ import javax.accessibility.*; * * @see JRootPane * - * @beaninfo - * attribute: isContainer true - * attribute: containerDelegate getContentPane - * description: A toplevel window which has no system border or controls. - * * @author David Kloba * @since 1.2 */ +@JavaBean(defaultProperty = "accessibleContext", description = "A toplevel window which has no system border or controls.") +@SwingContainer(delegate = "getContentPane") @SuppressWarnings("serial") public class JWindow extends Window implements Accessible, RootPaneContainer, @@ -328,12 +323,9 @@ public class JWindow extends Window implements Accessible, * @see #getTransferHandler * @see java.awt.Component#setDropTarget * @since 1.6 - * - * @beaninfo - * bound: true - * hidden: true - * description: Mechanism for transfer of data into the component */ + @BeanProperty(hidden = true, description + = "Mechanism for transfer of data into the component") public void setTransferHandler(TransferHandler newHandler) { TransferHandler oldHandler = transferHandler; transferHandler = newHandler; @@ -376,10 +368,9 @@ public class JWindow extends Window implements Accessible, * @see #setLayout * @see #isRootPaneCheckingEnabled * @see javax.swing.RootPaneContainer - * @beaninfo - * hidden: true - * description: Whether the add and setLayout methods are forwarded */ + @BeanProperty(hidden = true, description + = "Whether the add and setLayout methods are forwarded") protected void setRootPaneCheckingEnabled(boolean enabled) { rootPaneCheckingEnabled = enabled; } @@ -463,6 +454,8 @@ public class JWindow extends Window implements Accessible, * @see #setRootPane * @see RootPaneContainer#getRootPane */ + @BeanProperty(bound = false, hidden = true, description + = "the RootPane object for this window.") public JRootPane getRootPane() { return rootPane; } @@ -474,10 +467,6 @@ public class JWindow extends Window implements Accessible, * * @param root the new rootPane property * @see #getRootPane - * - * @beaninfo - * hidden: true - * description: the RootPane object for this window. */ protected void setRootPane(JRootPane root) { if(rootPane != null) { @@ -519,12 +508,9 @@ public class JWindow extends Window implements Accessible, * exception) if the content pane parameter is null * @see #getContentPane * @see RootPaneContainer#setContentPane - * - * @beaninfo - * hidden: true - * description: The client area of the window where child - * components are normally inserted. */ + @BeanProperty(bound = false, hidden = true, description + = "The client area of the window where child components are normally inserted.") public void setContentPane(Container contentPane) { getRootPane().setContentPane(contentPane); } @@ -550,11 +536,9 @@ public class JWindow extends Window implements Accessible, * exception) if the content pane parameter is null * @see #getLayeredPane * @see RootPaneContainer#setLayeredPane - * - * @beaninfo - * hidden: true - * description: The pane which holds the various window layers. */ + @BeanProperty(bound = false, hidden = true, description + = "The pane which holds the various window layers.") public void setLayeredPane(JLayeredPane layeredPane) { getRootPane().setLayeredPane(layeredPane); } @@ -577,11 +561,9 @@ public class JWindow extends Window implements Accessible, * * @see #getGlassPane * @see RootPaneContainer#setGlassPane - * - * @beaninfo - * hidden: true - * description: A transparent pane used for menu rendering. */ + @BeanProperty(bound = false, hidden = true, description + = "A transparent pane used for menu rendering.") public void setGlassPane(Component glassPane) { getRootPane().setGlassPane(glassPane); } @@ -591,6 +573,7 @@ public class JWindow extends Window implements Accessible, * * @since 1.6 */ + @BeanProperty(bound = false) public Graphics getGraphics() { JComponent.getGraphicsInvoked(this); return super.getGraphics(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/colorchooser/AbstractColorChooserPanel.java b/jdk/src/java.desktop/share/classes/javax/swing/colorchooser/AbstractColorChooserPanel.java index 374882a6cea..b3fda891612 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/colorchooser/AbstractColorChooserPanel.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/colorchooser/AbstractColorChooserPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,7 @@ package javax.swing.colorchooser; import java.awt.*; +import java.beans.BeanProperty; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import javax.swing.*; @@ -222,13 +223,10 @@ public abstract class AbstractColorChooserPanel extends JPanel { *

    The default value is {@code true}. * * @param b true if the transparency of a color can be selected - * - * @beaninfo - * bound: true - * description: Sets the transparency of a color selection on or off. - * * @see #isColorTransparencySelectionEnabled() */ + @BeanProperty(description + = "Sets the transparency of a color selection on or off.") public void setColorTransparencySelectionEnabled(boolean b){ } diff --git a/jdk/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java b/jdk/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java index 546e962c9fa..ac2802d93c4 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java @@ -22,7 +22,6 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ - package javax.swing.table; import sun.swing.table.DefaultTableCellHeaderRenderer; @@ -36,14 +35,13 @@ import javax.swing.event.*; import javax.swing.plaf.*; import javax.accessibility.*; +import java.beans.BeanProperty; import java.beans.PropertyChangeListener; import java.beans.Transient; import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; import java.io.IOException; - /** * This is the object which manages the header of the JTable. *

    @@ -167,10 +165,9 @@ public class JTableHeader extends JComponent implements TableColumnModelListener /** * Sets the table associated with this header. * @param table the new table - * @beaninfo - * bound: true - * description: The table associated with this header. */ + @BeanProperty(description + = "The table associated with this header.") public void setTable(JTable table) { JTable old = this.table; this.table = table; @@ -191,10 +188,9 @@ public class JTableHeader extends JComponent implements TableColumnModelListener * @param reorderingAllowed true if the table view should allow * reordering; otherwise false * @see #getReorderingAllowed - * @beaninfo - * bound: true - * description: Whether the user can drag column headers to reorder columns. */ + @BeanProperty(description + = "Whether the user can drag column headers to reorder columns.") public void setReorderingAllowed(boolean reorderingAllowed) { boolean old = this.reorderingAllowed; this.reorderingAllowed = reorderingAllowed; @@ -219,10 +215,9 @@ public class JTableHeader extends JComponent implements TableColumnModelListener * @param resizingAllowed true if table view should allow * resizing * @see #getResizingAllowed - * @beaninfo - * bound: true - * description: Whether the user can resize columns by dragging between headers. */ + @BeanProperty(description + = "Whether the user can resize columns by dragging between headers.") public void setResizingAllowed(boolean resizingAllowed) { boolean old = this.resizingAllowed; this.resizingAllowed = resizingAllowed; @@ -516,10 +511,9 @@ public class JTableHeader extends JComponent implements TableColumnModelListener * @exception IllegalArgumentException * if newModel is null * @see #getColumnModel - * @beaninfo - * bound: true - * description: The object governing the way columns appear in the view. */ + @BeanProperty(description + = "The object governing the way columns appear in the view.") public void setColumnModel(TableColumnModel columnModel) { if (columnModel == null) { throw new IllegalArgumentException("Cannot set a null ColumnModel"); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/table/TableColumn.java b/jdk/src/java.desktop/share/classes/javax/swing/table/TableColumn.java index 0d54da6d1d7..e1d908124d4 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/table/TableColumn.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/table/TableColumn.java @@ -26,6 +26,7 @@ package javax.swing.table; import java.awt.Component; +import java.beans.BeanProperty; import java.beans.PropertyChangeListener; import java.io.Serializable; @@ -308,10 +309,9 @@ public class TableColumn extends Object implements Serializable { * TableColumn. As the TableColumn * is moved around in the view the model index remains constant. * @param modelIndex the new modelIndex - * @beaninfo - * bound: true - * description: The model index. */ + @BeanProperty(description + = "The model index.") public void setModelIndex(int modelIndex) { int old = this.modelIndex; this.modelIndex = modelIndex; @@ -335,10 +335,9 @@ public class TableColumn extends Object implements Serializable { * * @param identifier an identifier for this column * @see #getIdentifier - * @beaninfo - * bound: true - * description: A unique identifier for this column. */ + @BeanProperty(description + = "A unique identifier for this column.") public void setIdentifier(Object identifier) { Object old = this.identifier; this.identifier = identifier; @@ -369,10 +368,9 @@ public class TableColumn extends Object implements Serializable { * is null. * @param headerValue the new headerValue * @see #getHeaderValue - * @beaninfo - * bound: true - * description: The text to be used by the header renderer. */ + @BeanProperty(description + = "The text to be used by the header renderer.") public void setHeaderValue(Object headerValue) { Object old = this.headerValue; this.headerValue = headerValue; @@ -405,10 +403,9 @@ public class TableColumn extends Object implements Serializable { * @param headerRenderer the new headerRenderer * * @see #getHeaderRenderer - * @beaninfo - * bound: true - * description: The header renderer. */ + @BeanProperty(description + = "The header renderer.") public void setHeaderRenderer(TableCellRenderer headerRenderer) { TableCellRenderer old = this.headerRenderer; this.headerRenderer = headerRenderer; @@ -437,10 +434,9 @@ public class TableColumn extends Object implements Serializable { * * @param cellRenderer the new cellRenderer * @see #getCellRenderer - * @beaninfo - * bound: true - * description: The renderer to use for cell values. */ + @BeanProperty(description + = "The renderer to use for cell values.") public void setCellRenderer(TableCellRenderer cellRenderer) { TableCellRenderer old = this.cellRenderer; this.cellRenderer = cellRenderer; @@ -471,10 +467,9 @@ public class TableColumn extends Object implements Serializable { * * @param cellEditor the new cellEditor * @see #getCellEditor - * @beaninfo - * bound: true - * description: The editor to use for cell values. */ + @BeanProperty(description + = "The editor to use for cell values.") public void setCellEditor(TableCellEditor cellEditor){ TableCellEditor old = this.cellEditor; this.cellEditor = cellEditor; @@ -515,10 +510,9 @@ public class TableColumn extends Object implements Serializable { * @see #setMaxWidth * @see #setPreferredWidth * @see JTable#doLayout() - * @beaninfo - * bound: true - * description: The width of the column. */ + @BeanProperty(description + = "The width of the column.") public void setWidth(int width) { int old = this.width; this.width = Math.min(Math.max(width, minWidth), maxWidth); @@ -549,10 +543,9 @@ public class TableColumn extends Object implements Serializable { * @param preferredWidth the new preferred width * @see #getPreferredWidth * @see JTable#doLayout() - * @beaninfo - * bound: true - * description: The preferred width of the column. */ + @BeanProperty(description + = "The preferred width of the column.") public void setPreferredWidth(int preferredWidth) { int old = this.preferredWidth; this.preferredWidth = Math.min(Math.max(preferredWidth, minWidth), maxWidth); @@ -588,10 +581,9 @@ public class TableColumn extends Object implements Serializable { * @see #getMinWidth * @see #setPreferredWidth * @see #setMaxWidth - * @beaninfo - * bound: true - * description: The minimum width of the column. */ + @BeanProperty(description + = "The minimum width of the column.") public void setMinWidth(int minWidth) { int old = this.minWidth; this.minWidth = Math.max(Math.min(minWidth, maxWidth), 0); @@ -633,10 +625,9 @@ public class TableColumn extends Object implements Serializable { * @see #getMaxWidth * @see #setPreferredWidth * @see #setMinWidth - * @beaninfo - * bound: true - * description: The maximum width of the column. */ + @BeanProperty(description + = "The maximum width of the column.") public void setMaxWidth(int maxWidth) { int old = this.maxWidth; this.maxWidth = Math.max(minWidth, maxWidth); @@ -667,10 +658,9 @@ public class TableColumn extends Object implements Serializable { * * @param isResizable if true, resizing is allowed; otherwise false * @see #getResizable - * @beaninfo - * bound: true - * description: Whether or not this column can be resized. */ + @BeanProperty(description + = "Whether or not this column can be resized.") public void setResizable(boolean isResizable) { boolean old = this.isResizable; this.isResizable = isResizable; diff --git a/jdk/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java b/jdk/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java index a088bb6f082..571745be89d 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java @@ -29,6 +29,8 @@ import com.sun.beans.util.Cache; import java.security.AccessController; import java.security.PrivilegedAction; +import java.beans.JavaBean; +import java.beans.BeanProperty; import java.beans.Transient; import java.util.HashMap; import java.util.Hashtable; @@ -276,9 +278,6 @@ import sun.swing.SwingAccessor; * has been added to the java.beans package. * Please see {@link java.beans.XMLEncoder}. * - * @beaninfo - * attribute: isContainer false - * * @author Timothy Prinzing * @author Igor Kushnirskiy (printing support) * @see Document @@ -291,6 +290,8 @@ import sun.swing.SwingAccessor; * @see View * @see ViewFactory */ +@JavaBean(defaultProperty = "UI") +@SwingContainer(false) @SuppressWarnings("serial") // Same-version serialization only public abstract class JTextComponent extends JComponent implements Scrollable, Accessible { @@ -375,6 +376,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * * @since 1.4 */ + @BeanProperty(bound = false) public CaretListener[] getCaretListeners() { return listenerList.getListeners(CaretListener.class); } @@ -409,11 +411,9 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * * @param doc the document to display/edit * @see #getDocument - * @beaninfo - * description: the text document model - * bound: true - * expert: true */ + @BeanProperty(expert = true, description + = "the text document model") public void setDocument(Document doc) { Document old = model; @@ -496,6 +496,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * * @return the command list */ + @BeanProperty(bound = false) public Action[] getActions() { return getUI().getEditorKit(this).getActions(); } @@ -511,10 +512,9 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * A PropertyChange event ("margin") is sent to all listeners. * * @param m the space between the border and the text - * @beaninfo - * description: desired space between the border and text area - * bound: true */ + @BeanProperty(description + = "desired space between the border and text area") public void setMargin(Insets m) { Insets old = margin; margin = m; @@ -576,11 +576,9 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * * @param c the caret * @see #getCaret - * @beaninfo - * description: the caret used to select/navigate - * bound: true - * expert: true */ + @BeanProperty(expert = true, description + = "the caret used to select/navigate") public void setCaret(Caret c) { if (caret != null) { caret.removeChangeListener(caretEvent); @@ -614,11 +612,9 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * * @param h the highlighter * @see #getHighlighter - * @beaninfo - * description: object responsible for background highlights - * bound: true - * expert: true */ + @BeanProperty(expert = true, description + = "object responsible for background highlights") public void setHighlighter(Highlighter h) { if (highlighter != null) { highlighter.deinstall(this); @@ -640,10 +636,9 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * * @param map the keymap * @see #getKeymap - * @beaninfo - * description: set of key event to action bindings to use - * bound: true */ + @BeanProperty(description + = "set of key event to action bindings to use") public void setKeymap(Keymap map) { Keymap old = keymap; keymap = map; @@ -679,11 +674,9 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * @see #setTransferHandler * @see TransferHandler * @since 1.4 - * - * @beaninfo - * description: determines whether automatic drag handling is enabled - * bound: false */ + @BeanProperty(bound = false, description + = "determines whether automatic drag handling is enabled") public void setDragEnabled(boolean b) { checkDragEnabled(b); dragEnabled = b; @@ -955,6 +948,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * @see TransferHandler#canImport(TransferHandler.TransferSupport) * @since 1.6 */ + @BeanProperty(bound = false) public final DropLocation getDropLocation() { return dropLocation; } @@ -1220,11 +1214,9 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * * @param c the color * @see #getCaretColor - * @beaninfo - * description: the color used to render the caret - * bound: true - * preferred: true */ + @BeanProperty(preferred = true, description + = "the color used to render the caret") public void setCaretColor(Color c) { Color old = caretColor; caretColor = c; @@ -1249,11 +1241,9 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * * @param c the color * @see #getSelectionColor - * @beaninfo - * description: color used to render selection background - * bound: true - * preferred: true */ + @BeanProperty(preferred = true, description + = "color used to render selection background") public void setSelectionColor(Color c) { Color old = selectionColor; selectionColor = c; @@ -1278,11 +1268,9 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * * @param c the color * @see #getSelectedTextColor - * @beaninfo - * description: color used to render selected text - * bound: true - * preferred: true */ + @BeanProperty(preferred = true, description + = "color used to render selected text") public void setSelectedTextColor(Color c) { Color old = selectedTextColor; selectedTextColor = c; @@ -1306,11 +1294,9 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * * @param c the color * @see #getDisabledTextColor - * @beaninfo - * description: color used to render disabled text - * bound: true - * preferred: true */ + @BeanProperty(preferred = true, description + = "color used to render disabled text") public void setDisabledTextColor(Color c) { Color old = disabledTextColor; disabledTextColor = c; @@ -1535,10 +1521,9 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * * @param aKey the key * @see #getFocusAccelerator - * @beaninfo - * description: accelerator character used to grab focus - * bound: true */ + @BeanProperty(description + = "accelerator character used to grab focus") public void setFocusAccelerator(char aKey) { aKey = Character.toUpperCase(aKey); char old = focusAccelerator; @@ -1632,9 +1617,9 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * @exception IllegalArgumentException if the value supplied * for position is less than zero or greater * than the component's text length - * @beaninfo - * description: the caret position */ + @BeanProperty(bound = false, description + = "the caret position") public void setCaretPosition(int position) { Document doc = getDocument(); if (doc != null) { @@ -1672,9 +1657,9 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * @param t the new text to be set * @see #getText * @see DefaultCaret - * @beaninfo - * description: the text of this component */ + @BeanProperty(bound = false, description + = "the text of this component") public void setText(String t) { try { Document doc = getDocument(); @@ -1724,6 +1709,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * have a valid mapping into the document for some reason * @see #setText */ + @BeanProperty(bound = false) public String getSelectedText() { String txt = null; int p0 = Math.min(caret.getDot(), caret.getMark()); @@ -1758,10 +1744,9 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * * @param b the boolean to be set * @see #isEditable - * @beaninfo - * description: specifies if the text can be edited - * bound: true */ + @BeanProperty(description + = "specifies if the text can be edited") public void setEditable(boolean b) { if (b != editable) { boolean oldVal = editable; @@ -1795,9 +1780,9 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * implementation which is where the actual selection is maintained. * * @param selectionStart the start position of the text ≥ 0 - * @beaninfo - * description: starting location of the selection. */ + @BeanProperty(bound = false, description + = "starting location of the selection.") public void setSelectionStart(int selectionStart) { /* Route through select method to enforce consistent policy * between selectionStart and selectionEnd. @@ -1828,9 +1813,9 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * implementation which is where the actual selection is maintained. * * @param selectionEnd the end position of the text ≥ 0 - * @beaninfo - * description: ending location of the selection. */ + @BeanProperty(bound = false, description + = "ending location of the selection.") public void setSelectionEnd(int selectionEnd) { /* Route through select method to enforce consistent policy * between selectionStart and selectionEnd. @@ -1946,6 +1931,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * @return the preferredSize of a JViewport * whose view is this Scrollable */ + @BeanProperty(bound = false) public Dimension getPreferredScrollableViewportSize() { return getPreferredSize(); } @@ -2029,6 +2015,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * @return true if a viewport should force the Scrollables * width to match its own */ + @BeanProperty(bound = false) public boolean getScrollableTracksViewportWidth() { Container parent = SwingUtilities.getUnwrappedParent(this); if (parent instanceof JViewport) { @@ -2050,6 +2037,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * @return true if a viewport should force the Scrollables height * to match its own */ + @BeanProperty(bound = false) public boolean getScrollableTracksViewportHeight() { Container parent = SwingUtilities.getUnwrappedParent(this); if (parent instanceof JViewport) { @@ -2484,6 +2472,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A * AccessibleContext of this * JTextComponent */ + @BeanProperty(bound = false) public AccessibleContext getAccessibleContext() { if (accessibleContext == null) { accessibleContext = new AccessibleJTextComponent(); @@ -4539,6 +4528,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A // // Overrides this method to become an active input method client. // + @BeanProperty(bound = false) public InputMethodRequests getInputMethodRequests() { if (inputMethodRequestsHandler == null) { inputMethodRequestsHandler = new InputMethodRequestsHandler(); diff --git a/jdk/src/java.desktop/share/classes/javax/swing/tree/AbstractLayoutCache.java b/jdk/src/java.desktop/share/classes/javax/swing/tree/AbstractLayoutCache.java index 3d0f4ef9d1f..23272555363 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/tree/AbstractLayoutCache.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/tree/AbstractLayoutCache.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,12 +22,11 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ - package javax.swing.tree; import javax.swing.event.TreeModelEvent; -import java.awt.Dimension; import java.awt.Rectangle; +import java.beans.BeanProperty; import java.util.Enumeration; /** @@ -112,11 +111,9 @@ public abstract class AbstractLayoutCache implements RowMapper { * * @param rootVisible true if the root node of the tree is to be displayed * @see #rootVisible - * @beaninfo - * bound: true - * description: Whether or not the root node - * from the TreeModel is visible. */ + @BeanProperty(description + = "Whether or not the root node from the TreeModel is visible.") public void setRootVisible(boolean rootVisible) { this.rootVisible = rootVisible; } @@ -137,10 +134,9 @@ public abstract class AbstractLayoutCache implements RowMapper { * queried for each row's height. * * @param rowHeight the height of each cell, in pixels - * @beaninfo - * bound: true - * description: The height of each cell. */ + @BeanProperty(description + = "The height of each cell.") public void setRowHeight(int rowHeight) { this.rowHeight = rowHeight; } diff --git a/jdk/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeCellEditor.java b/jdk/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeCellEditor.java index 0fe4e7eb1cd..8f76fe2952c 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeCellEditor.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeCellEditor.java @@ -22,7 +22,6 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ - package javax.swing.tree; import javax.swing.*; @@ -31,6 +30,7 @@ import javax.swing.event.*; import javax.swing.plaf.FontUIResource; import java.awt.*; import java.awt.event.*; +import java.beans.BeanProperty; import java.util.EventObject; /** @@ -592,12 +592,9 @@ public class DefaultTreeCellEditor implements ActionListener, TreeCellEditor, * @param border the border to be rendered for this component * @see Border * @see CompoundBorder - * @beaninfo - * bound: true - * preferred: true - * attribute: visualUpdate true - * description: The component's border. */ + @BeanProperty(preferred = true, visualUpdate = true, description + = "The component's border.") public void setBorder(Border border) { super.setBorder(border); this.border = border; diff --git a/jdk/src/java.desktop/share/classes/javax/swing/tree/VariableHeightLayoutCache.java b/jdk/src/java.desktop/share/classes/javax/swing/tree/VariableHeightLayoutCache.java index 470f07d930a..fea3a16131d 100644 --- a/jdk/src/java.desktop/share/classes/javax/swing/tree/VariableHeightLayoutCache.java +++ b/jdk/src/java.desktop/share/classes/javax/swing/tree/VariableHeightLayoutCache.java @@ -22,11 +22,11 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ - package javax.swing.tree; import javax.swing.event.TreeModelEvent; import java.awt.Rectangle; +import java.beans.BeanProperty; import java.util.Enumeration; import java.util.Hashtable; import java.util.NoSuchElementException; @@ -103,10 +103,9 @@ public class VariableHeightLayoutCache extends AbstractLayoutCache { * Sets the TreeModel that will provide the data. * * @param newModel the TreeModel that is to provide the data - * @beaninfo - * bound: true - * description: The TreeModel that will provide the data. */ + @BeanProperty(description + = "The TreeModel that will provide the data.") public void setModel(TreeModel newModel) { super.setModel(newModel); rebuild(false); @@ -118,11 +117,9 @@ public class VariableHeightLayoutCache extends AbstractLayoutCache { * * @param rootVisible true if the root node of the tree is to be displayed * @see #rootVisible - * @beaninfo - * bound: true - * description: Whether or not the root node - * from the TreeModel is visible. */ + @BeanProperty(description + = "Whether or not the root node from the TreeModel is visible.") public void setRootVisible(boolean rootVisible) { if(isRootVisible() != rootVisible && root != null) { if(rootVisible) { @@ -151,10 +148,9 @@ public class VariableHeightLayoutCache extends AbstractLayoutCache { * queried for each row's height. * * @param rowHeight the height of each cell, in pixels - * @beaninfo - * bound: true - * description: The height of each cell. */ + @BeanProperty(description + = "The height of each cell.") public void setRowHeight(int rowHeight) { if(rowHeight != getRowHeight()) { super.setRowHeight(rowHeight);