Progress Bars and Sliders


The assignment is rather short, so it is doubtful you will need a progress bar for your project. One possibility is to visually indicate how many seats are left on a flight (or whatever is applicable to your assignment scenario). A progress bar can be oriented horizontally (left to right, which is the default) or vertically (bottom to top). These are the progress bars and the slider used in Swing:

  • JProgressBar ” Displays a vertical or horizontal box that is progressively filled by a bar indicating what percentage of the task has been completed.

  • ProgressMonitor ” This component is related to JProgressBar, but isn't visible until it pops up a dialog box, if the operation will take a while.

  • JSlider ” This component enables the user to select a numeric value within a given range by sliding a knob. Forcing the user to pick the value by sliding the knob eliminates typing errors.

graphics/tip_icon.gif

Use components in your GUI that eliminate user typing errors. For example, make the user pick an item from a list or combo box instead of typing it into a text field.


The following snippet is an example for the JProgressBar:

 int minimum = 0;  //seats int maximum = 50; //seats JProgressBar progress = new JProgressBar(JProgressBar.VERTICAL, minimum, maximum); 


JavaT 2 Developer Exam CramT 2 (Exam CX-310-252A and CX-310-027)
JavaT 2 Developer Exam CramT 2 (Exam CX-310-252A and CX-310-027)
ISBN: N/A
EAN: N/A
Year: 2003
Pages: 187

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net