1 /* JProgressBar.java --
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.Graphics;
41 import java.io.IOException;
42 import java.io.ObjectOutputStream;
43 import javax.accessibility.Accessible;
44 import javax.accessibility.AccessibleContext;
45 import javax.accessibility.AccessibleRole;
46 import javax.accessibility.AccessibleStateSet;
47 import javax.accessibility.AccessibleValue;
48 import javax.swing.event.ChangeEvent;
49 import javax.swing.event.ChangeListener;
50 import javax.swing.plaf.ProgressBarUI;
54 * @author Andrew Selkirk
57 public class JProgressBar extends JComponent implements SwingConstants, Accessible
60 //-------------------------------------------------------------
61 // Classes ----------------------------------------------------
62 //-------------------------------------------------------------
66 * AccessibleJProgressBar
68 protected class AccessibleJProgressBar extends AccessibleJComponent
69 implements AccessibleValue {
71 //-------------------------------------------------------------
72 // Variables --------------------------------------------------
73 //-------------------------------------------------------------
76 //-------------------------------------------------------------
77 // Initialization ---------------------------------------------
78 //-------------------------------------------------------------
81 * Constructor AccessibleJProgressBar
82 * @param component TODO
84 protected AccessibleJProgressBar(JProgressBar component) {
87 } // AccessibleJProgressBar()
90 //-------------------------------------------------------------
91 // Methods ----------------------------------------------------
92 //-------------------------------------------------------------
95 * getAccessibleStateSet
96 * @returns AccessibleStateSet
98 public AccessibleStateSet getAccessibleStateSet() {
100 } // getAccessibleStateSet()
104 * @returns AccessibleRole
106 public AccessibleRole getAccessibleRole() {
107 return AccessibleRole.PROGRESS_BAR;
108 } // getAccessibleRole()
112 * @returns AccessibleValue
114 public AccessibleValue getAccessibleValue() {
116 } // getAccessibleValue()
119 * getCurrentAccessibleValue
122 public Number getCurrentAccessibleValue() {
124 } // getCurrentAccessibleValue()
127 * setCurrentAccessibleValue
131 public boolean setCurrentAccessibleValue(Number value0) {
132 return false; // TODO
133 } // setCurrentAccessibleValue()
136 * getMinimumAccessibleValue
139 public Number getMinimumAccessibleValue() {
141 } // getMinimumAccessibleValue()
144 * getMaximumAccessibleValue
147 public Number getMaximumAccessibleValue() {
149 } // getMaximumAccessibleValue()
152 } // AccessibleJProgressBar
155 //-------------------------------------------------------------
156 // Variables --------------------------------------------------
157 //-------------------------------------------------------------
162 private static final String uiClassID = "ProgressBarUI";
167 protected int orientation;
172 protected boolean paintBorder;
177 protected BoundedRangeModel model;
182 protected String progressString;
187 protected boolean paintString;
192 protected transient ChangeEvent changeEvent;
197 protected ChangeListener changeListener;
200 //-------------------------------------------------------------
201 // Initialization ---------------------------------------------
202 //-------------------------------------------------------------
205 * Constructor JProgressBar
207 public JProgressBar() {
212 * Constructor JProgressBar
213 * @param orientation TODO
215 public JProgressBar(int orientation) {
220 * Constructor JProgressBar
221 * @param minimum TODO
222 * @param maximum TODO
224 public JProgressBar(int minimum, int maximum) {
229 * Constructor JProgressBar
230 * @param minimum TODO
231 * @param maximum TODO
232 * @param orientation TODO
234 public JProgressBar(int minimum, int maximum, int orientation) {
239 * Constructor JProgressBar
242 public JProgressBar(BoundedRangeModel model) {
247 //-------------------------------------------------------------
248 // Methods ----------------------------------------------------
249 //-------------------------------------------------------------
254 * @exception IOException TODO
256 private void writeObject(ObjectOutputStream stream) throws IOException {
264 public int getValue() {
272 public void setValue(int value) {
278 * @param graphics TODO
280 protected void paintBorder(Graphics graphics) {
288 public int getOrientation() {
290 } // getOrientation()
294 * @param orientation TODO
296 public void setOrientation(int orientation) {
298 } // setOrientation()
304 public boolean isStringPainted() {
305 return false; // TODO
306 } // isStringPainted()
310 * @param painted TODO
312 public void setStringPainted(boolean painted) {
314 } // setStringPainted()
320 public String getString() {
328 public void setString(String string) {
336 public double getPercentComplete() {
338 } // getPercentComplete()
344 public boolean isBorderPainted() {
345 return false; // TODO
346 } // isBorderPainted()
350 * @param painted TODO
352 public void setBorderPainted(boolean painted) {
354 } // setBorderPainted()
358 * @returns ProgressBarUI
360 public ProgressBarUI getUI() {
361 return (ProgressBarUI) ui;
368 public void setUI(ProgressBarUI ui) {
376 public void updateUI() {
377 setUI((ProgressBarUI) UIManager.get(this));
385 public String getUIClassID() {
390 * createChangeListener
391 * @returns ChangeListener
393 protected ChangeListener createChangeListener() {
395 } // createChangeListener()
399 * @param listener TODO
401 public void addChangeListener(ChangeListener listener) {
403 } // addChangeListener()
406 * removeChangeListener
407 * @param listener TODO
409 public void removeChangeListener(ChangeListener valulistener) {
411 } // removeChangeListener()
416 protected void fireStateChanged() {
418 } // fireStateChanged()
422 * @returns BoundedRangeModel
424 public BoundedRangeModel getModel() {
432 public void setModel(BoundedRangeModel model) {
440 public int getMinimum() {
446 * @param minimum TODO
448 public void setMinimum(int minimum) {
456 public int getMaximum() {
462 * @param maximum TODO
464 public void setMaximum(int maximum) {
472 protected String paramString() {
477 * getAccessibleContext
478 * @returns AccessibleContext
480 public AccessibleContext getAccessibleContext() {
481 if (accessibleContext == null) {
482 accessibleContext = new AccessibleJProgressBar(this);
484 return accessibleContext;
485 } // getAccessibleContext()