jdk/src/share/classes/javax/swing/JInternalFrame.java

Print this page

        

@@ -20,32 +20,33 @@
  *
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-
 package javax.swing;
 
 import java.awt.*;
 
+import java.beans.JavaBean;
+import java.beans.BeanProperty;
 import java.beans.PropertyVetoException;
 import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
 
 import javax.swing.event.InternalFrameEvent;
 import javax.swing.event.InternalFrameListener;
 import javax.swing.plaf.*;
 
 import javax.accessibility.*;
 
 import java.io.ObjectOutputStream;
 import java.io.IOException;
 import java.lang.StringBuilder;
-import java.beans.PropertyChangeListener;
+
 import sun.awt.AppContext;
 import sun.swing.SwingUtilities2;
 
-
 /**
  * A lightweight object that provides many of the features of
  * a native frame, including dragging, closing, becoming an icon,
  * resizing, title display, and support for a menu bar.
  * For task-oriented documentation and examples of using internal frames,

@@ -103,16 +104,13 @@
  * @see javax.swing.RootPaneContainer
  *
  * @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,
         RootPaneContainer
 {

@@ -376,16 +374,13 @@
     }
 
     /**
      * Sets the UI delegate for this <code>JInternalFrame</code>.
      * @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 {
             setRootPaneCheckingEnabled(false);
             super.setUI(ui);

@@ -433,14 +428,13 @@
      *
      * @return the string "InternalFrameUI"
      *
      * @see JComponent#getUIClassID
      * @see UIDefaults#getUI
-     *
-     * @beaninfo
-     *     description: UIClassID
      */
+    @BeanProperty(bound = false, description
+            = "UIClassID")
     public String getUIClassID() {
         return uiClassID;
     }
 
     /**

@@ -469,14 +463,13 @@
      *
      * @see #addImpl
      * @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;
     }
 
     /**

@@ -594,16 +587,13 @@
     /**
      * Sets the <code>menuBar</code> property for this <code>JInternalFrame</code>.
      *
      * @param m  the <code>JMenuBar</code> 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);
         firePropertyChange(MENU_BAR_PROPERTY, oldValue, m);
     }

@@ -625,16 +615,13 @@
      * @param c  the content pane for this internal frame
      *
      * @exception java.awt.IllegalComponentStateException (a runtime
      *           exception) if the content pane parameter is <code>null</code>
      * @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);
         firePropertyChange(CONTENT_PANE_PROPERTY, oldValue, c);
     }

@@ -657,15 +644,13 @@
      * @param layered the <code>JLayeredPane</code> for this internal frame
      *
      * @exception java.awt.IllegalComponentStateException (a runtime
      *           exception) if the layered pane parameter is <code>null</code>
      * @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);
         firePropertyChange(LAYERED_PANE_PROPERTY, oldValue, layered);
     }

@@ -684,15 +669,13 @@
      * Sets this <code>JInternalFrame</code>'s
      * <code>glassPane</code> property.
      *
      * @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);
         firePropertyChange(GLASS_PANE_PROPERTY, oldValue, glass);
     }

@@ -701,10 +684,12 @@
      * Returns the <code>rootPane</code> object for this internal frame.
      *
      * @return the <code>rootPane</code> property
      * @see RootPaneContainer#getRootPane
      */
+    @BeanProperty(hidden = true, description
+            = "The root pane used by this internal frame.")
     public JRootPane getRootPane() {
         return rootPane;
     }
 
 

@@ -712,14 +697,10 @@
      * Sets the <code>rootPane</code> property
      * for this <code>JInternalFrame</code>.
      * This method is called by the constructor.
      *
      * @param root  the new <code>JRootPane</code> object
-     * @beaninfo
-     *     bound: true
-     *     hidden: true
-     *     description: The root pane used by this internal frame.
      */
     protected void setRootPane(JRootPane root) {
         if(rootPane != null) {
             remove(rootPane);
         }

@@ -740,15 +721,13 @@
 
     /**
      * Sets whether this <code>JInternalFrame</code> can be closed by
      * some user action.
      * @param b a boolean value, where <code>true</code> 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;
         closable = b;
         firePropertyChange("closable", oldValue, newValue);

@@ -806,16 +785,13 @@
      *
      * @see #isClosed()
      * @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;
         }
 

@@ -843,16 +819,13 @@
     /**
      * Sets whether the <code>JInternalFrame</code> can be resized by some
      * user action.
      *
      * @param b  a boolean, where <code>true</code> 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;
         resizable = b;
         firePropertyChange("resizable", oldValue, newValue);

@@ -876,15 +849,13 @@
      * make the <code>JInternalFrame</code> an icon.
      * Some look and feels might not implement iconification;
      * they will ignore this property.
      *
      * @param b  a boolean, where <code>true</code> 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;
         iconable = b;
         firePropertyChange("iconable", oldValue, newValue);

@@ -924,16 +895,13 @@
      * @exception PropertyVetoException when the attempt to set the
      *            property is vetoed by the <code>JInternalFrame</code>
      *
      * @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;
         }
 

@@ -963,15 +931,13 @@
      * some user action.
      * Some look and feels might not support maximizing internal frames;
      * they will ignore this property.
      *
      * @param b <code>true</code> to specify that this internal frame should be maximizable; <code>false</code> 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;
         maximizable = b;
         firePropertyChange("maximizable", oldValue, newValue);

@@ -1005,15 +971,13 @@
      *
      * @param b  a boolean, where <code>true</code> maximizes this internal frame and <code>false</code>
      *           restores it
      * @exception PropertyVetoException when the attempt to set the
      *            property is vetoed by the <code>JInternalFrame</code>
-     * @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;
         }
 

@@ -1041,15 +1005,13 @@
      * Sets the <code>JInternalFrame</code> title. <code>title</code>
      * may have a <code>null</code> value.
      * @see #getTitle
      *
      * @param title  the <code>String</code> 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;
         firePropertyChange(TITLE_PROPERTY, oldValue, title);
     }

@@ -1075,17 +1037,13 @@
      *            property is vetoed by the <code>JInternalFrame</code>
      *
      * @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
        // which previously had it. See Bug 4302764.
         if (selected && isSelected) {

@@ -1151,14 +1109,13 @@
      * appropriate behavior for that situation, such as displaying no icon
      * or a default icon for the look and feel.
      *
      * @param icon the <code>Icon</code> 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;
         firePropertyChange(FRAME_ICON_PROPERTY, oldIcon, icon);
     }

@@ -1212,10 +1169,11 @@
      * <code>Cursor</code>.
      *
      * @return the last non-resizable <code>Cursor</code>
      * @since 1.6
      */
+    @BeanProperty(bound = false)
     public Cursor getLastCursor() {
         return lastCursor;
     }
 
     /**

@@ -1246,14 +1204,13 @@
      * Convenience method for setting the layer attribute of this component.
      *
      * @param layer  an <code>Integer</code> object specifying this
      *          frame's desktop layer
      * @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
             // to draw properly.
             JLayeredPane p = (JLayeredPane)getParent();

@@ -1277,14 +1234,13 @@
      *
      * @since 1.3
      *
      * @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));
     }
 
     /**

@@ -1304,10 +1260,11 @@
       * finds none, the <code>desktopIcon</code> tree is searched.
       *
       * @return the <code>JDesktopPane</code> this internal frame belongs to,
       *         or <code>null</code> if none is found
       */
+    @BeanProperty(bound = false)
     public JDesktopPane getDesktopPane() {
         Container p;
 
         // Search upward for desktop
         p = getParent();

@@ -1328,14 +1285,13 @@
      * Sets the <code>JDesktopIcon</code> associated with this
      * <code>JInternalFrame</code>.
      *
      * @param d the <code>JDesktopIcon</code> 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;
         firePropertyChange("desktopIcon", oldValue, d);
     }

@@ -1421,10 +1377,11 @@
      *         <code>JInternalFrame</code> is selected
      * @see #getFocusOwner
      * @see #isSelected
      * @since 1.4
      */
+    @BeanProperty(bound = false)
     public Component getMostRecentFocusOwner() {
         if (isSelected()) {
             return getFocusOwner();
         }
 

@@ -1534,10 +1491,11 @@
      *         array if no listeners have been added
      * @since 1.4
      *
      * @see #addInternalFrameListener
      */
+    @BeanProperty(bound = false)
     public InternalFrameListener[] getInternalFrameListeners() {
         return listenerList.getListeners(InternalFrameListener.class);
     }
 
     // remind: name ok? all one method ok? need to be synchronized?

@@ -1865,10 +1823,11 @@
      *
      * @return <code>null</code>
      * @see java.awt.Container#isFocusCycleRoot()
      * @since 1.4
      */
+    @BeanProperty(bound = false)
     public final Container getFocusCycleRootAncestor() {
         return null;
     }
 
     /**

@@ -1877,10 +1836,11 @@
      * contained within a window that might need a warning string)
      * this method always returns <code>null</code>.
      * @return    <code>null</code>
      * @see       java.awt.Window#getWarningString
      */
+    @BeanProperty(bound = false)
     public final String getWarningString() {
         return null;
     }
 
     /**

@@ -2012,10 +1972,11 @@
      * @return an <code>AccessibleJInternalFrame</code> that serves as the
      *         <code>AccessibleContext</code> of this
      *         <code>JInternalFrame</code>
      * @see AccessibleJInternalFrame
      */
+    @BeanProperty(bound = false)
     public AccessibleContext getAccessibleContext() {
         if (accessibleContext == null) {
             accessibleContext = new AccessibleJInternalFrame();
         }
         return accessibleContext;