2 Copyright (C) 2002, 2004 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
40 import java.awt.Component;
41 import java.awt.Dimension;
42 import java.awt.Graphics;
43 import java.awt.Insets;
44 import java.beans.PropertyChangeListener;
45 import java.io.IOException;
46 import java.io.ObjectOutputStream;
48 import javax.accessibility.Accessible;
49 import javax.accessibility.AccessibleContext;
50 import javax.accessibility.AccessibleRole;
51 import javax.accessibility.AccessibleStateSet;
52 import javax.swing.plaf.ToolBarUI;
56 * @author Andrew Selkirk
59 public class JToolBar extends JComponent
60 implements SwingConstants, Accessible
63 //-------------------------------------------------------------
64 // Classes ----------------------------------------------------
65 //-------------------------------------------------------------
70 protected class AccessibleJToolBar extends AccessibleJComponent {
72 //-------------------------------------------------------------
73 // Initialization ---------------------------------------------
74 //-------------------------------------------------------------
77 * Constructor AccessibleJToolBar
78 * @param component TODO
80 protected AccessibleJToolBar(JToolBar component) {
83 } // AccessibleJToolBar()
86 //-------------------------------------------------------------
87 // Methods ----------------------------------------------------
88 //-------------------------------------------------------------
91 * getAccessibleStateSet
92 * @returns AccessibleStateSet
94 public AccessibleStateSet getAccessibleStateSet() {
96 } // getAccessibleStateSet()
100 * @returns AccessibleRole
102 public AccessibleRole getAccessibleRole() {
103 return AccessibleRole.TOOL_BAR;
104 } // getAccessibleRole()
107 } // AccessibleJToolBar
112 public static class Separator extends JSeparator {
114 //-------------------------------------------------------------
115 // Variables --------------------------------------------------
116 //-------------------------------------------------------------
121 private Dimension size;
124 //-------------------------------------------------------------
125 // Initialization ---------------------------------------------
126 //-------------------------------------------------------------
129 * Constructor Separator
136 * Constructor Separator
139 public Separator(Dimension size) {
144 //-------------------------------------------------------------
145 // Methods ----------------------------------------------------
146 //-------------------------------------------------------------
152 public String getUIClassID() {
160 public Dimension getPreferredSize() {
162 } // getPreferredSize()
168 public Dimension getMaximumSize() {
170 } // getMaximumSize()
176 public Dimension getMinimumSize() {
178 } // getMinimumSize()
184 public Dimension getSeparatorSize() {
186 } // getSeparatorSize()
192 public void setSeparatorSize(Dimension size) {
194 } // setSeparatorSize()
200 //-------------------------------------------------------------
201 // Variables --------------------------------------------------
202 //-------------------------------------------------------------
207 private static final String uiClassID = "ToolBarUI";
212 private boolean paintBorder;
217 private Insets margin;
222 private boolean floatable;
227 private int orientation;
230 //-------------------------------------------------------------
231 // Initialization ---------------------------------------------
232 //-------------------------------------------------------------
235 * Constructor JToolBar
242 * Constructor JToolBar
243 * @param orientation TODO
245 public JToolBar(int orientation) {
250 * Constructor JToolBar
253 public JToolBar(String name) {
258 * Constructor JToolBar
260 * @param orientation TODO
262 public JToolBar(String name, int orientation) {
267 //-------------------------------------------------------------
268 // Methods ----------------------------------------------------
269 //-------------------------------------------------------------
274 * @exception IOException TODO
276 private void writeObject(ObjectOutputStream stream) throws IOException {
285 public JButton add(Action action) {
291 * @param graphics TODO
293 protected void paintBorder(Graphics graphics) {
301 public ToolBarUI getUI() {
302 return (ToolBarUI) ui;
309 public void setUI(ToolBarUI ui) {
316 public void updateUI() {
317 setUI((ToolBarUI) UIManager.get(this));
325 public String getUIClassID() {
331 * @param component TODO
334 public int getComponentIndex(Component component) {
336 } // getComponentIndex()
339 * getComponentAtIndex
343 public Component getComponentAtIndex(int index) {
345 } // getComponentAtIndex()
351 public Insets getMargin() {
359 public void setMargin(Insets margin) {
367 public boolean isBorderPainted() {
368 return false; // TODO
369 } // isBorderPainted()
373 * @param painted TODO
375 public void setBorderPainted(boolean painted) {
377 } // setBorderPainted()
383 public boolean isFloatable() {
384 return false; // TODO
389 * @param floatable TODO
391 public void setFloatable(boolean floatable) {
399 public int getOrientation() {
401 } // getOrientation()
405 * @param orientation TODO
407 public void setOrientation(int orientation) {
409 } // setOrientation()
414 public void addSeparator() {
422 public void addSeparator(Dimension size) {
427 * createActionComponent
431 protected JButton createActionComponent(Action action) {
433 } // createActionComponent()
436 * createActionChangeListener
438 * @returns PropertyChangeListener
440 protected PropertyChangeListener createActionChangeListener(JButton button) {
442 } // createActionChangeListener()
446 * @param component TODO
447 * @param constraints TODO
450 protected void addImpl(Component component, Object constraints, int index) {
458 protected String paramString() {
463 * getAccessibleContext
464 * @returns AccessibleContext
466 public AccessibleContext getAccessibleContext() {
467 if (accessibleContext == null) {
468 accessibleContext = new AccessibleJToolBar(this);
470 return accessibleContext;
471 } // getAccessibleContext()