2362N/A * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * <code>JToolBar</code> provides a component that is useful for 0N/A * displaying commonly used <code>Action</code>s or controls. 0N/A * For examples and information on using tool bars see 0N/A * a section in <em>The Java Tutorial</em>. 0N/A * With most look and feels, 0N/A * the user can drag out a tool bar into a separate window 0N/A * (unless the <code>floatable</code> property is set to <code>false</code>). 0N/A * For drag-out to work correctly, it is recommended that you add 0N/A * <code>JToolBar</code> instances to one of the four "sides" of a 0N/A * container whose layout manager is a <code>BorderLayout</code>, 0N/A * and do not add children to any of the other four "sides". 0N/A * <strong>Warning:</strong> Swing is not thread safe. For more 0N/A * information see <a 0N/A * <strong>Warning:</strong> 0N/A * Serialized objects of this class will not be compatible with 0N/A * future Swing releases. The current serialization support is 0N/A * appropriate for short term storage or RMI between applications running 0N/A * the same version of Swing. As of 1.4, support for long term storage 0N/A * of all JavaBeans<sup><font size="-2">TM</font></sup> 0N/A * has been added to the <code>java.beans</code> package. 0N/A * attribute: isContainer true 0N/A * description: A component which displays commonly used controls or Actions. 0N/A * @author Georges Saab 0N/A * @author Jeff Shapiro 0N/A * @see #getUIClassID 0N/A * Creates a new tool bar; orientation defaults to <code>HORIZONTAL</code>. 0N/A * Creates a new tool bar with the specified <code>orientation</code>. 0N/A * The <code>orientation</code> must be either <code>HORIZONTAL</code> 0N/A * or <code>VERTICAL</code>. 0N/A * @param orientation the orientation desired 0N/A * Creates a new tool bar with the specified <code>name</code>. The 0N/A * name is used as the title of the undocked tool bar. The default 0N/A * orientation is <code>HORIZONTAL</code>. 0N/A * @param name the name of the tool bar 0N/A * Creates a new tool bar with a specified <code>name</code> and 0N/A * <code>orientation</code>. 0N/A * All other constructors call this constructor. 0N/A * If <code>orientation</code> is an invalid value, an exception will 0N/A * @param name the name of the tool bar 0N/A * @param orientation the initial orientation -- it must be 0N/A * either <code>HORIZONTAL</code> or <code>VERTICAL</code> 0N/A * @exception IllegalArgumentException if orientation is neither 0N/A * <code>HORIZONTAL</code> nor <code>VERTICAL</code> 0N/A * Returns the tool bar's current UI. 0N/A * Sets the L&F object that renders this component. 0N/A * @param ui the <code>ToolBarUI</code> L&F object 0N/A * @see UIDefaults#getUI 0N/A * attribute: visualUpdate true 0N/A * description: The UI object that implements the Component's LookAndFeel. 0N/A * Notification from the <code>UIFactory</code> that the L&F has changed. 0N/A * Called to replace the UI with the latest version from the 0N/A * <code>UIFactory</code>. 0N/A * @see JComponent#updateUI 0N/A // GTKLookAndFeel installs a different LayoutManager, and sets it 0N/A // to null after changing the look and feel, so, install the default 0N/A // if the LayoutManager is null. 0N/A * Returns the name of the L&F class that renders this component. 0N/A * @return the string "ToolBarUI" 0N/A * @see JComponent#getUIClassID 0N/A * @see UIDefaults#getUI 0N/A * Returns the index of the specified component. 0N/A * (Note: Separators occupy index positions.) 0N/A * @param c the <code>Component</code> to find 0N/A * @return an integer indicating the component's position, 0N/A * Returns the component at the specified index. 0N/A * @param i the component's position, where 0 is first 0N/A * @return the <code>Component</code> at that position, 0N/A * or <code>null</code> for an invalid index 0N/A * Sets the margin between the tool bar's border and 0N/A * its buttons. Setting to <code>null</code> causes the tool bar to 0N/A * use the default margins. The tool bar's default <code>Border</code> 0N/A * object uses this value to create the proper margin. 0N/A * However, if a non-default border is set on the tool bar, 0N/A * it is that <code>Border</code> object's responsibility to create the 0N/A * appropriate margin space (otherwise this property will 0N/A * effectively be ignored). 0N/A * @param m an <code>Insets</code> object that defines the space 0N/A * between the border and the buttons 0N/A * description: The margin between the tool bar's border and contents 0N/A * Returns the margin between the tool bar's border and 0N/A * @return an <code>Insets</code> object containing the margin values 0N/A * Gets the <code>borderPainted</code> property. 0N/A * @return the value of the <code>borderPainted</code> property 0N/A * @see #setBorderPainted 0N/A * Sets the <code>borderPainted</code> property, which is 0N/A * <code>true</code> if the border should be painted. 0N/A * The default value for this property is <code>true</code>. 0N/A * Some look and feels might not implement painted borders; 0N/A * they will ignore this property. 0N/A * @param b if true, the border is painted 0N/A * @see #isBorderPainted 0N/A * description: Does the tool bar paint its borders? 0N/A * Paints the tool bar's border if the <code>borderPainted</code> property 0N/A * is <code>true</code>. 0N/A * @param g the <code>Graphics</code> context in which the painting 0N/A * @see JComponent#paint 0N/A * @see JComponent#setBorder 0N/A * Gets the <code>floatable</code> property. 0N/A * @return the value of the <code>floatable</code> property 0N/A * @see #setFloatable 0N/A * Sets the <code>floatable</code> property, 0N/A * which must be <code>true</code> for the user to move the tool bar. 0N/A * Typically, a floatable tool bar can be 0N/A * dragged into a different position within the same container 0N/A * or out into its own window. 0N/A * The default value of this property is <code>true</code>. 0N/A * Some look and feels might not implement floatable tool bars; 0N/A * they will ignore this property. 0N/A * @param b if <code>true</code>, the tool bar can be moved; 0N/A * <code>false</code> otherwise 0N/A * description: Can the tool bar be made to float by the user? 0N/A * Returns the current orientation of the tool bar. The value is either 0N/A * <code>HORIZONTAL</code> or <code>VERTICAL</code>. 0N/A * @return an integer representing the current orientation -- either 0N/A * <code>HORIZONTAL</code> or <code>VERTICAL</code> 0N/A * @see #setOrientation 0N/A * Sets the orientation of the tool bar. The orientation must have 0N/A * either the value <code>HORIZONTAL</code> or <code>VERTICAL</code>. 0N/A * If <code>orientation</code> is 0N/A * an invalid value, an exception will be thrown. 0N/A * @param o the new orientation -- either <code>HORIZONTAL</code> or 0N/A * <code>VERTICAL</code> 0N/A * @exception IllegalArgumentException if orientation is neither 0N/A * <code>HORIZONTAL</code> nor <code>VERTICAL</code> 0N/A * @see #getOrientation 0N/A * description: The current orientation of the tool bar 0N/A * enum: HORIZONTAL SwingConstants.HORIZONTAL 0N/A * VERTICAL SwingConstants.VERTICAL 0N/A * Sets the rollover state of this toolbar. If the rollover state is true 0N/A * then the border of the toolbar buttons will be drawn only when the 0N/A * mouse pointer hovers over them. The default value of this property 0N/A * The implementation of a look and feel may choose to ignore this 0N/A * @param rollover true for rollover toolbar buttons; otherwise false 0N/A * attribute: visualUpdate true 0N/A * description: Will draw rollover button borders in the toolbar. 0N/A * Returns the rollover state. 0N/A * @return true if rollover toolbar buttons are to be drawn; otherwise false 0N/A * @see #setRollover(boolean) 0N/A * Appends a separator of default size to the end of the tool bar. 0N/A * The default size is determined by the current look and feel. 0N/A * Appends a separator of a specified size to the end 0N/A * @param size the <code>Dimension</code> of the separator 0N/A * Adds a new <code>JButton</code> which dispatches the action. 0N/A * @param a the <code>Action</code> object to add as a new menu item 0N/A * @return the new button which dispatches the action 0N/A * Factory method which creates the <code>JButton</code> for 0N/A * <code>Action</code>s added to the <code>JToolBar</code>. 0N/A * The default name is empty if a <code>null</code> action is passed. 0N/A * @param a the <code>Action</code> for the button to be added 0N/A * @return the newly created button 0N/A * Returns a properly configured <code>PropertyChangeListener</code> 0N/A * which updates the control as changes to the <code>Action</code> occur, 0N/A * or <code>null</code> if the default 0N/A * property change listener for the control is desired. 0N/A * @return <code>null</code> 0N/A * If a <code>JButton</code> is being added, it is initially 0N/A * set to be disabled. 0N/A * @param comp the component to be enhanced 0N/A * @param constraints the constraints to be enforced on the component 0N/A * @param index the index of the component 0N/A * A toolbar-specific separator. An object with dimension but 0N/A * no contents used to divide buttons on a tool bar into groups. 0N/A * Creates a new toolbar separator with the default size 0N/A * as defined by the current look and feel. 0N/A this(
null );
// let the UI define the default size 0N/A * Creates a new toolbar separator with the specified size. 0N/A * @param size the <code>Dimension</code> of the separator 0N/A * Returns the name of the L&F class that renders this component. 0N/A * @return the string "ToolBarSeparatorUI" 0N/A * @see JComponent#getUIClassID 0N/A * @see UIDefaults#getUI 0N/A return "ToolBarSeparatorUI";
0N/A * Sets the size of the separator. 0N/A * @param size the new <code>Dimension</code> of the separator 0N/A * Returns the size of the separator 0N/A * @return the <code>Dimension</code> object containing the separator's 0N/A * size (This is a reference, NOT a copy!) 0N/A * Returns the minimum size for the separator. 0N/A * @return the <code>Dimension</code> object containing the separator's 0N/A * Returns the maximum size for the separator. 0N/A * @return the <code>Dimension</code> object containing the separator's 0N/A * Returns the preferred size for the separator. 0N/A * @return the <code>Dimension</code> object containing the separator's 0N/A * See <code>readObject</code> and <code>writeObject</code> in 0N/A * <code>JComponent</code> for more 0N/A * information about serialization in Swing. 0N/A * Returns a string representation of this <code>JToolBar</code>. 0N/A * is intended to be used only for debugging purposes, and the 0N/A * content and format of the returned string may vary between 0N/A * implementations. The returned string may be empty but may not 0N/A * be <code>null</code>. 0N/A * @return a string representation of this <code>JToolBar</code>. 0N/A "HORIZONTAL" :
"VERTICAL");
0N/A// Accessibility support 0N/A * Gets the AccessibleContext associated with this JToolBar. 0N/A * For tool bars, the AccessibleContext takes the form of an 0N/A * AccessibleJToolBar. 0N/A * A new AccessibleJToolBar instance is created if necessary. 0N/A * @return an AccessibleJToolBar that serves as the 0N/A * AccessibleContext of this JToolBar 0N/A * This class implements accessibility support for the 0N/A * <code>JToolBar</code> class. It provides an implementation of the 0N/A * Java Accessibility API appropriate to toolbar user-interface elements. 0N/A * Get the state of this object. 0N/A * @return an instance of AccessibleStateSet containing the current 0N/A * state set of the object 0N/A * @see AccessibleState 0N/A // FIXME: [[[WDW - need to add orientation from BoxLayout]]] 0N/A // FIXME: [[[WDW - need to do SELECTABLE if SelectionModel is added]]] 0N/A * Get the role of this object. 0N/A * @return an instance of AccessibleRole describing the role of the object 0N/A }
// inner class AccessibleJToolBar