File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes scrollbar constructor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "scrollbar constructor" Watch "scrollbar constructor" New topic
Author

scrollbar constructor

mita
Ranch Hand

Joined: Jul 19, 2000
Posts: 50
Hi,
I am confused with the Scrollbar's costructor.Could someone please explain what are initialvalue, slidersize, minvalue & maxvalue if possible with an example.
Thanks.
mita
Scrollbar(int Orientation, int initialvale, int slidersize, int minvalue, int maxvalue)
mita
Ranch Hand

Joined: Jul 19, 2000
Posts: 50
PLEASE someone help me.I know this is a simple question, but I can't get it.
Thanks
deekasha gunwant
Ranch Hand

Joined: May 06, 2000
Posts: 396
hi mita,
here is the explanation.
public Scrollbar(int orientation,int value, int visible,int minimum,int maximum)
The orientation argument must take one of the two values Scrollbar.HORIZONTAL
, or Scrollbar.VERTICAL, indicating a horizontal or vertical scroll bar, respectively.
If the specified maximum value is less than the minimum value, it is changed to be the same as the minimum value. If the initial value is lower than the minimum value, it is changed to be the minimum value; if it is greater than the maximum value, it is changed to be the maximum value.
Parameters:
--------------------------------------------------------
Orientation -indicates if the scroll bar is vertical or horizontaldefault value is Scrollbar.VERTICAL
--------------------------------------------------------
value-value which controls the location of the scroll bar bubbledefault value is 0
------------------------------------------------------------
minimumminimum value of the scroll bar.
default -0
----------------------------------------------------------
maximummaximum value of the scroll bar.default-100
---------------------------------------------------------
here is the example run it/ modify it. may be it'll help u
------------------------------
import java.awt.*;
class Scrollbars extends Frame
{
Scrollbars()
{

//red VERTICAL scrollbar
Scrollbar redbar =new Scrollbar(Scrollbar.VERTICAL, 20, 50, 10, 255);
//blue VERTICAL scrollbar
Scrollbar bluebar =new Scrollbar(Scrollbar.VERTICAL, 200, 10, 100, 255);
// blue HORIZONTAL scrollbar
Scrollbar greenbar =new Scrollbar(Scrollbar.HORIZONTAL, 50, 5, 5, 255);
redbar.setBackground(Color.red);
greenbar.setBackground(Color.green);
bluebar.setBackground(Color.blue);

add(greenbar,BorderLayout.NORTH);
add(bluebar,BorderLayout.WEST);
add(redbar,BorderLayout.EAST);
}
public static void main(String d[])
{
Scrollbars sb = new Scrollbars();
sb.setSize(400,400);
sb.setVisible(true);
}
}
-------------------------------

regards
deekasha
[This message has been edited by deekasha gunwant (edited August 19, 2000).]
mita
Ranch Hand

Joined: Jul 19, 2000
Posts: 50
Thanks so much Deekasha.I appreciate it.
mita
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: scrollbar constructor