Scroll bars:
A scroll bar is generally used as an input control element that enables a slider to be moved; when the slider is moved it transmits a value from some minimum value to a maximum value. There are a number of constructors associated with the JScrollBar class. The zero-argument constructor creates a scroll bar. The one-argument constructor is used to specify whether a scroll bar is to be displayed horizontally or vertically. For example:
JScrollBar scbV = new JScrollBar(JScrollBar.VERTICAL);
JScrollBar scbH = new JScrollBar(JScrollBar.HORIZONTAL);
The single argument to this constructor is one of two static constants, which can be found in the JScrollBar class. You will find yourself using the five-argument
constructor most. The arguments for this constructor are in the following order:
1 the constant that indicates the orientation;
2 the starting position of the scroll bar;
3 the scrolling increment;
4 the minimum value to be communicated by the scroll bar;
5 the maximum value to be communicated by the scroll bar.
So, for example, the statement:
JScrollBar scbV = new JScrollBar
(JScrollBar.VERTICAL, 20, 5, 0, 80);
creates a vertical scroll bar that has a starting position of 20, an increment of 5, a minimum value of 0 and a maximum value of 80. When the slider in this scroll bar is moved the value is incremented or decremented in steps of 5.
A value generated by a scroll bar can be accessed by a variety of methods associated with the JScrollBar class. For example, the method getValue returns the current value of the scroll bar, getMinimum returns the integer that represents the minimum value of the scroll bar, setValue sets the value of the scroll bar and getOrientation returns the orientation of the scroll bar. There is also a variety of methods that alter the parameters of the scroll bar. An example of the use of the getValue method is shown below:
JScrollBar scbV = new JScrollBar
(JScrollBar.VERTICAL, 20, 5, 0, 80);
...
int currValue = scbV.getValue( );
...
Here, currValue is updated to contain the current value of scbV. Figure shows some of the elements described in this section being displayed in a window.
Java Assignment Help - Java Homework Help
Struggling with java programming language? Are you not finding solution for your Scroll bars homework and assignments? Live Scroll bars experts are working for students by solving their doubts & questions during their course studies and training program. We at Expertsmind.com offer Scroll bars homework help, java assignment help and Scroll bars projects help anytime from anywhere for 24x7 hours. Computer science programming assignments help making life easy for students.
Why Expertsmind for assignment help
- Higher degree holder and experienced experts network
- Punctuality and responsibility of work
- Quality solution with 100% plagiarism free answers
- Time on Delivery
- Privacy of information and details
- Excellence in solving java programming language queries in excels and word format.
- Best tutoring assistance 24x7 hours