001 /*
002 * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation. Sun designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Sun in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022 * CA 95054 USA or visit www.sun.com if you need additional information or
023 * have any questions.
024 */
025
026 package javax.swing;
027
028 import java.awt.Color;
029 import java.awt.Component;
030 import java.awt.ComponentOrientation;
031 import java.awt.Container;
032 import java.awt.Dimension;
033 import java.awt.Graphics;
034 import java.awt.Insets;
035 import java.awt.LayoutManager;
036 import java.awt.LayoutManager2;
037 import java.awt.event.*;
038 import java.beans.*;
039
040 import javax.swing.border.Border;
041 import javax.swing.plaf.*;
042 import javax.accessibility.*;
043
044 import java.io.Serializable;
045 import java.io.ObjectOutputStream;
046 import java.io.ObjectInputStream;
047 import java.io.IOException;
048 import java.util.Hashtable;
049
050 /**
051 * <code>JToolBar</code> provides a component that is useful for
052 * displaying commonly used <code>Action</code>s or controls.
053 * For examples and information on using tool bars see
054 * <a href="http://java.sun.com/docs/books/tutorial/uiswing/components/toolbar.html">How to Use Tool Bars</a>,
055 * a section in <em>The Java Tutorial</em>.
056 *
057 * <p>
058 * With most look and feels,
059 * the user can drag out a tool bar into a separate window
060 * (unless the <code>floatable</code> property is set to <code>false</code>).
061 * For drag-out to work correctly, it is recommended that you add
062 * <code>JToolBar</code> instances to one of the four "sides" of a
063 * container whose layout manager is a <code>BorderLayout</code>,
064 * and do not add children to any of the other four "sides".
065 * <p>
066 * <strong>Warning:</strong> Swing is not thread safe. For more
067 * information see <a
068 * href="package-summary.html#threading">Swing's Threading
069 * Policy</a>.
070 * <p>
071 * <strong>Warning:</strong>
072 * Serialized objects of this class will not be compatible with
073 * future Swing releases. The current serialization support is
074 * appropriate for short term storage or RMI between applications running
075 * the same version of Swing. As of 1.4, support for long term storage
076 * of all JavaBeans<sup><font size="-2">TM</font></sup>
077 * has been added to the <code>java.beans</code> package.
078 * Please see {@link java.beans.XMLEncoder}.
079 *
080 * @beaninfo
081 * attribute: isContainer true
082 * description: A component which displays commonly used controls or Actions.
083 *
084 * @version 1.122 05/05/07
085 * @author Georges Saab
086 * @author Jeff Shapiro
087 * @see Action
088 */
089 public class JToolBar extends JComponent implements SwingConstants,
090 Accessible {
091 /**
092 * @see #getUIClassID
093 * @see #readObject
094 */
095 private static final String uiClassID = "ToolBarUI";
096
097 private boolean paintBorder = true;
098 private Insets margin = null;
099 private boolean floatable = true;
100 private int orientation = HORIZONTAL;
101
102 /**
103 * Creates a new tool bar; orientation defaults to <code>HORIZONTAL</code>.
104 */
105 public JToolBar() {
106 this (HORIZONTAL);
107 }
108
109 /**
110 * Creates a new tool bar with the specified <code>orientation</code>.
111 * The <code>orientation</code> must be either <code>HORIZONTAL</code>
112 * or <code>VERTICAL</code>.
113 *
114 * @param orientation the orientation desired
115 */
116 public JToolBar(int orientation) {
117 this (null, orientation);
118 }
119
120 /**
121 * Creates a new tool bar with the specified <code>name</code>. The
122 * name is used as the title of the undocked tool bar. The default
123 * orientation is <code>HORIZONTAL</code>.
124 *
125 * @param name the name of the tool bar
126 * @since 1.3
127 */
128 public JToolBar(String name) {
129 this (name, HORIZONTAL);
130 }
131
132 /**
133 * Creates a new tool bar with a specified <code>name</code> and
134 * <code>orientation</code>.
135 * All other constructors call this constructor.
136 * If <code>orientation</code> is an invalid value, an exception will
137 * be thrown.
138 *
139 * @param name the name of the tool bar
140 * @param orientation the initial orientation -- it must be
141 * either <code>HORIZONTAL</code> or <code>VERTICAL</code>
142 * @exception IllegalArgumentException if orientation is neither
143 * <code>HORIZONTAL</code> nor <code>VERTICAL</code>
144 * @since 1.3
145 */
146 public JToolBar(String name, int orientation) {
147 setName(name);
148 checkOrientation(orientation);
149
150 this .orientation = orientation;
151 DefaultToolBarLayout layout = new DefaultToolBarLayout(
152 orientation);
153 setLayout(layout);
154
155 addPropertyChangeListener(layout);
156
157 updateUI();
158 }
159
160 /**
161 * Returns the tool bar's current UI.
162 * @see #setUI
163 */
164 public ToolBarUI getUI() {
165 return (ToolBarUI) ui;
166 }
167
168 /**
169 * Sets the L&F object that renders this component.
170 *
171 * @param ui the <code>ToolBarUI</code> L&F object
172 * @see UIDefaults#getUI
173 * @beaninfo
174 * bound: true
175 * hidden: true
176 * attribute: visualUpdate true
177 * description: The UI object that implements the Component's LookAndFeel.
178 */
179 public void setUI(ToolBarUI ui) {
180 super .setUI(ui);
181 }
182
183 /**
184 * Notification from the <code>UIFactory</code> that the L&F has changed.
185 * Called to replace the UI with the latest version from the
186 * <code>UIFactory</code>.
187 *
188 * @see JComponent#updateUI
189 */
190 public void updateUI() {
191 setUI((ToolBarUI) UIManager.getUI(this ));
192 // GTKLookAndFeel installs a different LayoutManager, and sets it
193 // to null after changing the look and feel, so, install the default
194 // if the LayoutManager is null.
195 if (getLayout() == null) {
196 setLayout(new DefaultToolBarLayout(getOrientation()));
197 }
198 invalidate();
199 }
200
201 /**
202 * Returns the name of the L&F class that renders this component.
203 *
204 * @return the string "ToolBarUI"
205 * @see JComponent#getUIClassID
206 * @see UIDefaults#getUI
207 */
208 public String getUIClassID() {
209 return uiClassID;
210 }
211
212 /**
213 * Returns the index of the specified component.
214 * (Note: Separators occupy index positions.)
215 *
216 * @param c the <code>Component</code> to find
217 * @return an integer indicating the component's position,
218 * where 0 is first
219 */
220 public int getComponentIndex(Component c) {
221 int ncomponents = this .getComponentCount();
222 Component[] component = this .getComponents();
223 for (int i = 0; i < ncomponents; i++) {
224 Component comp = component[i];
225 if (comp == c)
226 return i;
227 }
228 return -1;
229 }
230
231 /**
232 * Returns the component at the specified index.
233 *
234 * @param i the component's position, where 0 is first
235 * @return the <code>Component</code> at that position,
236 * or <code>null</code> for an invalid index
237 *
238 */
239 public Component getComponentAtIndex(int i) {
240 int ncomponents = this .getComponentCount();
241 if (i >= 0 && i < ncomponents) {
242 Component[] component = this .getComponents();
243 return component[i];
244 }
245 return null;
246 }
247
248 /**
249 * Sets the margin between the tool bar's border and
250 * its buttons. Setting to <code>null</code> causes the tool bar to
251 * use the default margins. The tool bar's default <code>Border</code>
252 * object uses this value to create the proper margin.
253 * However, if a non-default border is set on the tool bar,
254 * it is that <code>Border</code> object's responsibility to create the
255 * appropriate margin space (otherwise this property will
256 * effectively be ignored).
257 *
258 * @param m an <code>Insets</code> object that defines the space
259 * between the border and the buttons
260 * @see Insets
261 * @beaninfo
262 * description: The margin between the tool bar's border and contents
263 * bound: true
264 * expert: true
265 */
266 public void setMargin(Insets m) {
267 Insets old = margin;
268 margin = m;
269 firePropertyChange("margin", old, m);
270 revalidate();
271 repaint();
272 }
273
274 /**
275 * Returns the margin between the tool bar's border and
276 * its buttons.
277 *
278 * @return an <code>Insets</code> object containing the margin values
279 * @see Insets
280 */
281 public Insets getMargin() {
282 if (margin == null) {
283 return new Insets(0, 0, 0, 0);
284 } else {
285 return margin;
286 }
287 }
288
289 /**
290 * Gets the <code>borderPainted</code> property.
291 *
292 * @return the value of the <code>borderPainted</code> property
293 * @see #setBorderPainted
294 */
295 public boolean isBorderPainted() {
296 return paintBorder;
297 }
298
299 /**
300 * Sets the <code>borderPainted</code> property, which is
301 * <code>true</code> if the border should be painted.
302 * The default value for this property is <code>true</code>.
303 * Some look and feels might not implement painted borders;
304 * they will ignore this property.
305 *
306 * @param b if true, the border is painted
307 * @see #isBorderPainted
308 * @beaninfo
309 * description: Does the tool bar paint its borders?
310 * bound: true
311 * expert: true
312 */
313 public void setBorderPainted(boolean b) {
314 if (paintBorder != b) {
315 boolean old = paintBorder;
316 paintBorder = b;
317 firePropertyChange("borderPainted", old, b);
318 revalidate();
319 repaint();
320 }
321 }
322
323 /**
324 * Paints the tool bar's border if the <code>borderPainted</code> property
325 * is <code>true</code>.
326 *
327 * @param g the <code>Graphics</code> context in which the painting
328 * is done
329 * @see JComponent#paint
330 * @see JComponent#setBorder
331 */
332 protected void paintBorder(Graphics g) {
333 if (isBorderPainted()) {
334 super .paintBorder(g);
335 }
336 }
337
338 /**
339 * Gets the <code>floatable</code> property.
340 *
341 * @return the value of the <code>floatable</code> property
342 *
343 * @see #setFloatable
344 */
345 public boolean isFloatable() {
346 return floatable;
347 }
348
349 /**
350 * Sets the <code>floatable</code> property,
351 * which must be <code>true</code> for the user to move the tool bar.
352 * Typically, a floatable tool bar can be
353 * dragged into a different position within the same container
354 * or out into its own window.
355 * The default value of this property is <code>true</code>.
356 * Some look and feels might not implement floatable tool bars;
357 * they will ignore this property.
358 *
359 * @param b if <code>true</code>, the tool bar can be moved;
360 * <code>false</code> otherwise
361 * @see #isFloatable
362 * @beaninfo
363 * description: Can the tool bar be made to float by the user?
364 * bound: true
365 * preferred: true
366 */
367 public void setFloatable(boolean b) {
368 if (floatable != b) {
369 boolean old = floatable;
370 floatable = b;
371
372 firePropertyChange("floatable", old, b);
373 revalidate();
374 repaint();
375 }
376 }
377
378 /**
379 * Returns the current orientation of the tool bar. The value is either
380 * <code>HORIZONTAL</code> or <code>VERTICAL</code>.
381 *
382 * @return an integer representing the current orientation -- either
383 * <code>HORIZONTAL</code> or <code>VERTICAL</code>
384 * @see #setOrientation
385 */
386 public int getOrientation() {
387 return this .orientation;
388 }
389
390 /**
391 * Sets the orientation of the tool bar. The orientation must have
392 * either the value <code>HORIZONTAL</code> or <code>VERTICAL</code>.
393 * If <code>orientation</code> is
394 * an invalid value, an exception will be thrown.
395 *
396 * @param o the new orientation -- either <code>HORIZONTAL</code> or
397 * <code>VERTICAL</code>
398 * @exception IllegalArgumentException if orientation is neither
399 * <code>HORIZONTAL</code> nor <code>VERTICAL</code>
400 * @see #getOrientation
401 * @beaninfo
402 * description: The current orientation of the tool bar
403 * bound: true
404 * preferred: true
405 * enum: HORIZONTAL SwingConstants.HORIZONTAL
406 * VERTICAL SwingConstants.VERTICAL
407 */
408 public void setOrientation(int o) {
409 checkOrientation(o);
410
411 if (orientation != o) {
412 int old = orientation;
413 orientation = o;
414
415 firePropertyChange("orientation", old, o);
416 revalidate();
417 repaint();
418 }
419 }
420
421 /**
422 * Sets the rollover state of this toolbar. If the rollover state is true
423 * then the border of the toolbar buttons will be drawn only when the
424 * mouse pointer hovers over them. The default value of this property
425 * is false.
426 * <p>
427 * The implementation of a look and feel may choose to ignore this
428 * property.
429 *
430 * @param rollover true for rollover toolbar buttons; otherwise false
431 * @since 1.4
432 * @beaninfo
433 * bound: true
434 * preferred: true
435 * attribute: visualUpdate true
436 * description: Will draw rollover button borders in the toolbar.
437 */
438 public void setRollover(boolean rollover) {
439 putClientProperty("JToolBar.isRollover",
440 rollover ? Boolean.TRUE : Boolean.FALSE);
441 }
442
443 /**
444 * Returns the rollover state.
445 *
446 * @return true if rollover toolbar buttons are to be drawn; otherwise false
447 * @see #setRollover(boolean)
448 * @since 1.4
449 */
450 public boolean isRollover() {
451 Boolean rollover = (Boolean) getClientProperty("JToolBar.isRollover");
452 if (rollover != null) {
453 return rollover.booleanValue();
454 }
455 return false;
456 }
457
458 private void checkOrientation(int orientation) {
459 switch (orientation) {
460 case VERTICAL:
461 case HORIZONTAL:
462 break;
463 default:
464 throw new IllegalArgumentException(
465 "orientation must be one of: VERTICAL, HORIZONTAL");
466 }
467 }
468
469 /**
470 * Appends a separator of default size to the end of the tool bar.
471 * The default size is determined by the current look and feel.
472 */
473 public void addSeparator() {
474 addSeparator(null);
475 }
476
477 /**
478 * Appends a separator of a specified size to the end
479 * of the tool bar.
480 *
481 * @param size the <code>Dimension</code> of the separator
482 */
483 public void addSeparator(Dimension size) {
484 JToolBar.Separator s = new JToolBar.Separator(size);
485 add(s);
486 }
487
488 /**
489 * Adds a new <code>JButton</code> which dispatches the action.
490 *
491 * @param a the <code>Action</code> object to add as a new menu item
492 * @return the new button which dispatches the action
493 */
494 public JButton add(Action a) {
495 JButton b = createActionComponent(a);
496 b.setAction(a);
497 add(b);
498 return b;
499 }
500
501 /**
502 * Factory method which creates the <code>JButton</code> for
503 * <code>Action</code>s added to the <code>JToolBar</code>.
504 * The default name is empty if a <code>null</code> action is passed.
505 *
506 * @param a the <code>Action</code> for the button to be added
507 * @return the newly created button
508 * @see Action
509 * @since 1.3
510 */
511 protected JButton createActionComponent(Action a) {
512 JButton b = new JButton() {
513 protected PropertyChangeListener createActionPropertyChangeListener(
514 Action a) {
515 PropertyChangeListener pcl = createActionChangeListener(this );
516 if (pcl == null) {
517 pcl = super .createActionPropertyChangeListener(a);
518 }
519 return pcl;
520 }
521 };
522 if (a != null
523 && (a.getValue(Action.SMALL_ICON) != null || a
524 .getValue(Action.LARGE_ICON_KEY) != null)) {
525 b.setHideActionText(true);
526 }
527 b.setHorizontalTextPosition(JButton.CENTER);
528 b.setVerticalTextPosition(JButton.BOTTOM);
529 return b;
530 }
531
532 /**
533 * Returns a properly configured <code>PropertyChangeListener</code>
534 * which updates the control as changes to the <code>Action</code> occur,
535 * or <code>null</code> if the default
536 * property change listener for the control is desired.
537 *
538 * @return <code>null</code>
539 */
540 protected PropertyChangeListener createActionChangeListener(
541 JButton b) {
542 return null;
543 }
544
545 /**
546 * If a <code>JButton</code> is being added, it is initially
547 * set to be disabled.
548 *
549 * @param comp the component to be enhanced
550 * @param constraints the constraints to be enforced on the component
551 * @param index the index of the component
552 *
553 */
554 protected void addImpl(Component comp, Object constraints, int index) {
555 if (comp instanceof Separator) {
556 if (getOrientation() == VERTICAL) {
557 ((Separator) comp)
558 .setOrientation(JSeparator.HORIZONTAL);
559 } else {
560 ((Separator) comp).setOrientation(JSeparator.VERTICAL);
561 }
562 }
563 super .addImpl(comp, constraints, index);
564 if (comp instanceof JButton) {
565 ((JButton) comp).setDefaultCapable(false);
566 }
567 }
568
569 /**
570 * A toolbar-specific separator. An object with dimension but
571 * no contents used to divide buttons on a tool bar into groups.
572 */
573 static public class Separator extends JSeparator {
574 private Dimension separatorSize;
575
576 /**
577 * Creates a new toolbar separator with the default size
578 * as defined by the current look and feel.
579 */
580 public Separator() {
581 this (null); // let the UI define the default size
582 }
583
584 /**
585 * Creates a new toolbar separator with the specified size.
586 *
587 * @param size the <code>Dimension</code> of the separator
588 */
589 public Separator(Dimension size) {
590 super (JSeparator.HORIZONTAL);
591 setSeparatorSize(size);
592 }
593
594 /**
595 * Returns the name of the L&F class that renders this component.
596 *
597 * @return the string "ToolBarSeparatorUI"
598 * @see JComponent#getUIClassID
599 * @see UIDefaults#getUI
600 */
601 public String getUIClassID() {
602 return "ToolBarSeparatorUI";
603 }
604
605 /**
606 * Sets the size of the separator.
607 *
608 * @param size the new <code>Dimension</code> of the separator
609 */
610 public void setSeparatorSize(Dimension size) {
611 if (size != null) {
612 separatorSize = size;
613 } else {
614 super .updateUI();
615 }
616 this .invalidate();
617 }
618
619 /**
620 * Returns the size of the separator
621 *
622 * @return the <code>Dimension</code> object containing the separator's
623 * size (This is a reference, NOT a copy!)
624 */
625 public Dimension getSeparatorSize() {
626 return separatorSize;
627 }
628
629 /**
630 * Returns the minimum size for the separator.
631 *
632 * @return the <code>Dimension</code> object containing the separator's
633 * minimum size
634 */
635 public Dimension getMinimumSize() {
636 if (separatorSize != null) {
637 return separatorSize.getSize();
638 } else {
639 return super .getMinimumSize();
640 }
641 }
642
643 /**
644 * Returns the maximum size for the separator.
645 *
646 * @return the <code>Dimension</code> object containing the separator's
647 * maximum size
648 */
649 public Dimension getMaximumSize() {
650 if (separatorSize != null) {
651 return separatorSize.getSize();
652 } else {
653 return super .getMaximumSize();
654 }
655 }
656
657 /**
658 * Returns the preferred size for the separator.
659 *
660 * @return the <code>Dimension</code> object containing the separator's
661 * preferred size
662 */
663 public Dimension getPreferredSize() {
664 if (separatorSize != null) {
665 return separatorSize.getSize();
666 } else {
667 return super .getPreferredSize();
668 }
669 }
670 }
671
672 /**
673 * See <code>readObject</code> and <code>writeObject</code> in
674 * <code>JComponent</code> for more
675 * information about serialization in Swing.
676 */
677 private void writeObject(ObjectOutputStream s) throws IOException {
678 s.defaultWriteObject();
679 if (getUIClassID().equals(uiClassID)) {
680 byte count = JComponent.getWriteObjCounter(this );
681 JComponent.setWriteObjCounter(this , --count);
682 if (count == 0 && ui != null) {
683 ui.installUI(this );
684 }
685 }
686 }
687
688 /**
689 * Returns a string representation of this <code>JToolBar</code>.
690 * This method
691 * is intended to be used only for debugging purposes, and the
692 * content and format of the returned string may vary between
693 * implementations. The returned string may be empty but may not
694 * be <code>null</code>.
695 *
696 * @return a string representation of this <code>JToolBar</code>.
697 */
698 protected String paramString() {
699 String paintBorderString = (paintBorder ? "true" : "false");
700 String marginString = (margin != null ? margin.toString() : "");
701 String floatableString = (floatable ? "true" : "false");
702 String orientationString = (orientation == HORIZONTAL ? "HORIZONTAL"
703 : "VERTICAL");
704
705 return super .paramString() + ",floatable=" + floatableString
706 + ",margin=" + marginString + ",orientation="
707 + orientationString + ",paintBorder="
708 + paintBorderString;
709 }
710
711 private class DefaultToolBarLayout implements LayoutManager2,
712 Serializable, PropertyChangeListener, UIResource {
713
714 BoxLayout lm;
715
716 DefaultToolBarLayout(int orientation) {
717 if (orientation == JToolBar.VERTICAL) {
718 lm = new BoxLayout(JToolBar.this , BoxLayout.PAGE_AXIS);
719 } else {
720 lm = new BoxLayout(JToolBar.this , BoxLayout.LINE_AXIS);
721 }
722 }
723
724 public void addLayoutComponent(String name, Component comp) {
725 lm.addLayoutComponent(name, comp);
726 }
727
728 public void addLayoutComponent(Component comp,
729 Object constraints) {
730 lm.addLayoutComponent(comp, constraints);
731 }
732
733 public void removeLayoutComponent(Component comp) {
734 lm.removeLayoutComponent(comp);
735 }
736
737 public Dimension preferredLayoutSize(Container target) {
738 return lm.preferredLayoutSize(target);
739 }
740
741 public Dimension minimumLayoutSize(Container target) {
742 return lm.minimumLayoutSize(target);
743 }
744
745 public Dimension maximumLayoutSize(Container target) {
746 return lm.maximumLayoutSize(target);
747 }
748
749 public void layoutContainer(Container target) {
750 lm.layoutContainer(target);
751 }
752
753 public float getLayoutAlignmentX(Container target) {
754 return lm.getLayoutAlignmentX(target);
755 }
756
757 public float getLayoutAlignmentY(Container target) {
758 return lm.getLayoutAlignmentY(target);
759 }
760
761 public void invalidateLayout(Container target) {
762 lm.invalidateLayout(target);
763 }
764
765 public void propertyChange(PropertyChangeEvent e) {
766 String name = e.getPropertyName();
767 if (name.equals("orientation")) {
768 int o = ((Integer) e.getNewValue()).intValue();
769
770 if (o == JToolBar.VERTICAL)
771 lm = new BoxLayout(JToolBar.this ,
772 BoxLayout.PAGE_AXIS);
773 else {
774 lm = new BoxLayout(JToolBar.this ,
775 BoxLayout.LINE_AXIS);
776 }
777 }
778 }
779 }
780
781 public void setLayout(LayoutManager mgr) {
782 LayoutManager oldMgr = getLayout();
783 if (oldMgr instanceof PropertyChangeListener) {
784 removePropertyChangeListener((PropertyChangeListener) oldMgr);
785 }
786 super .setLayout(mgr);
787 }
788
789 /////////////////
790 // Accessibility support
791 ////////////////
792
793 /**
794 * Gets the AccessibleContext associated with this JToolBar.
795 * For tool bars, the AccessibleContext takes the form of an
796 * AccessibleJToolBar.
797 * A new AccessibleJToolBar instance is created if necessary.
798 *
799 * @return an AccessibleJToolBar that serves as the
800 * AccessibleContext of this JToolBar
801 */
802 public AccessibleContext getAccessibleContext() {
803 if (accessibleContext == null) {
804 accessibleContext = new AccessibleJToolBar();
805 }
806 return accessibleContext;
807 }
808
809 /**
810 * This class implements accessibility support for the
811 * <code>JToolBar</code> class. It provides an implementation of the
812 * Java Accessibility API appropriate to toolbar user-interface elements.
813 */
814 protected class AccessibleJToolBar extends AccessibleJComponent {
815
816 /**
817 * Get the state of this object.
818 *
819 * @return an instance of AccessibleStateSet containing the current
820 * state set of the object
821 * @see AccessibleState
822 */
823 public AccessibleStateSet getAccessibleStateSet() {
824 AccessibleStateSet states = super .getAccessibleStateSet();
825 // FIXME: [[[WDW - need to add orientation from BoxLayout]]]
826 // FIXME: [[[WDW - need to do SELECTABLE if SelectionModel is added]]]
827 return states;
828 }
829
830 /**
831 * Get the role of this object.
832 *
833 * @return an instance of AccessibleRole describing the role of the object
834 */
835 public AccessibleRole getAccessibleRole() {
836 return AccessibleRole.TOOL_BAR;
837 }
838 } // inner class AccessibleJToolBar
839 }
|