01: /*
02: #IFNDEF ALT_LICENSE
03: ThinWire(R) RIA Ajax Framework
04: Copyright (C) 2003-2007 Custom Credit Systems
05:
06: This library is free software; you can redistribute it and/or modify it under
07: the terms of the GNU Lesser General Public License as published by the Free
08: Software Foundation; either version 2.1 of the License, or (at your option) any
09: later version.
10:
11: This library is distributed in the hope that it will be useful, but WITHOUT ANY
12: WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13: PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14:
15: You should have received a copy of the GNU Lesser General Public License along
16: with this library; if not, write to the Free Software Foundation, Inc., 59
17: Temple Place, Suite 330, Boston, MA 02111-1307 USA
18:
19: Users who would rather have a commercial license, warranty or support should
20: contact the following company who invented, built and supports the technology:
21:
22: Custom Credit Systems, Richardson, TX 75081, USA.
23: email: info@thinwire.com ph: +1 (888) 644-6405
24: http://www.thinwire.com
25: #ENDIF
26: [ v1.2_RC2 ]
27: */
28: package thinwire.ui;
29:
30: /**
31: * A ProgressBar is a screen element that has a visible selection that can be set to any size between zero and a specified length.
32: * ProgressBars are either horizontal or vertical depending on their dimensions. If the width is greater than the height,
33: * then the ProgressBar is horizontal, otherwise it is vertical.
34: * <p>
35: * <b>Example:</b> <br>
36: * <img src="doc-files/ProgressBar-1.png"> <br>
37: *
38: * <pre>
39: * Frame f = Application.current().getFrame();
40: * f.setTitle("ProgressBar Test");
41: * Dialog d = new Dialog("ProgressBar Test");
42: * d.setBounds(10, 10, 250, 150);
43: * final ProgressBar pb = new ProgressBar(5, 3);
44: * pb.setBounds(10, 10, 100, 20);
45: * d.getChildren().add(pb);
46: * final TextField tf = new TextField();
47: * tf.setBounds(10, 40, 50, 20);
48: * tf.setText(String.valueOf(pb.getCurrentIndex()));
49: * d.getChildren().add(tf);
50: * Button b = new Button("SetValue");
51: * b.setBounds(70, 35, 60, 30);
52: * b.addActionListener(Button.ACTION_CLICK, new ActionListener() {
53: * public void actionPerformed(ActionEvent ev) {
54: * pb.setCurrentIndex(Integer.parseInt(tf.getText()));
55: * }
56: * });
57: * d.getChildren().add(b);
58: * f.getChildren().add(d);
59: * </pre>
60: *
61: * </p>
62: *
63: * @author Ted C. Howard
64: *
65: */
66: public class ProgressBar extends AbstractRangeComponent {
67: /**
68: * Constructs a new <code>ProgressBar</code> with a length of 100 and a currentIndex of 0.
69: *
70: */
71: public ProgressBar() {
72: this (100, 0);
73: }
74:
75: /**
76: * Constructs a new <code>ProgressBar</code> with the specified length and a currentIndex of 0.
77: * @param length
78: */
79: public ProgressBar(int length) {
80: this (length, 0);
81: }
82:
83: /**
84: * Constructs a new <code>ProgressBar</code> with the specified length and currentIndex.
85: * @param length
86: * @param currentIndex
87: */
88: public ProgressBar(int length, int currentIndex) {
89: setLength(length);
90: setCurrentIndex(currentIndex);
91: }
92: }
|