--- old/src/java.desktop/share/classes/javax/swing/JPopupMenu.java 2015-09-19 03:04:14.015393900 +0300 +++ new/src/java.desktop/share/classes/javax/swing/JPopupMenu.java 2015-09-19 03:04:13.807200400 +0300 @@ -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.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 @@ * 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 @@ * * @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 @@ * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; } @@ -274,10 +266,9 @@ * * @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 @@ * 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 @@ * @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 @@ * 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 @@ * 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 @@ * * @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 @@ * 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 @@ * * @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 @@ * * @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 @@ * * @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 @@ * 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 @@ * * @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 @@ * * @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 @@ * @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 @@ * @return an array of MenuElement objects * @see MenuElement#getSubElements */ + @BeanProperty(bound = false) public MenuElement[] getSubElements() { MenuElement result[]; Vector tmp = new Vector();