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

Print this page

        

@@ -20,35 +20,30 @@
  *
  * 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.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;
-
 
 /**
  * <code>JToolBar</code> provides a component that is useful for
  * displaying commonly used <code>Action</code>s or controls.
  * For examples and information on using tool bars see

@@ -76,19 +71,17 @@
  * the same version of Swing.  As of 1.4, support for long term storage
  * of all JavaBeans&trade;
  * has been added to the <code>java.beans</code> 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
 {
     /**
      * @see #getUIClassID

@@ -173,16 +166,13 @@
     /**
      * Sets the L&amp;F object that renders this component.
      *
      * @param ui  the <code>ToolBarUI</code> L&amp;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);
     }
 
     /**

@@ -210,10 +200,11 @@
      *
      * @return the string "ToolBarUI"
      * @see JComponent#getUIClassID
      * @see UIDefaults#getUI
      */
+    @BeanProperty(bound = false)
     public String getUIClassID() {
         return uiClassID;
     }
 
 

@@ -264,15 +255,13 @@
       * effectively be ignored).
       *
       * @param m an <code>Insets</code> 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;
          margin = m;
          firePropertyChange("margin", old, m);

@@ -315,15 +304,13 @@
       * Some look and feels might not implement painted borders;
       * they will ignore this property.
       *
       * @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 )
          {
              boolean old = paintBorder;

@@ -374,15 +361,13 @@
       * they will ignore this property.
       *
       * @param b if <code>true</code>, the tool bar can be moved;
       *          <code>false</code> 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 )
         {
             boolean old = floatable;

@@ -416,17 +401,15 @@
      * @param o  the new orientation -- either <code>HORIZONTAL</code> or
      *                  <code>VERTICAL</code>
      * @exception IllegalArgumentException if orientation is neither
      *          <code>HORIZONTAL</code> nor <code>VERTICAL</code>
      * @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 );
 
         if ( orientation != o )

@@ -449,16 +432,13 @@
      * The implementation of a look and feel may choose to ignore this
      * property.
      *
      * @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);
     }
 

@@ -834,10 +814,11 @@
      * A new AccessibleJToolBar instance is created if necessary.
      *
      * @return an AccessibleJToolBar that serves as the
      *         AccessibleContext of this JToolBar
      */
+    @BeanProperty(bound = false)
     public AccessibleContext getAccessibleContext() {
         if (accessibleContext == null) {
             accessibleContext = new AccessibleJToolBar();
         }
         return accessibleContext;