Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Resize the Scrollbar in AWT?

Status
Not open for further replies.

whodaman

Programmer
May 23, 2001
60
CA
I have been trying all over the place to try to extend the scroll bar. I have used
scrollbar = new Scrollbar(Scrollbar.VERTICAL, 0, 1, 0, 100);
scrollbar.setSize(15, 100);
And it still does not work. It always gives me a width of 15 and height of 50. That's annoyingly small. What can I do to correct this?
 
I also ran my code though the debugger and got these values for the scrollbar

{x=0, y=0, width=15, height=100, visible=true, enabled=true, valid=false}

What does it mean when valid=false? Could I have an image over the location I want to put it in?
 
Hi,

What do you mean by you want to extend the scrollbar? The size of the scrollbar is always the same. The only thing you can set for a scrollbar is the value(the cursorr in between the 2 arrows), minimum value(the minimum value of the scrollbar), maximum value(the maximum value of the scrollbar), the unit increment(the amount the cursor moves while the arrows at the side are clicked) and the block increment(for pageup and pagedown purposes)

Regarding valid, I am not very sure too. Perhaps when valid is true, you are able to scroll and otherwise when valid is false? For your adding image question, I am also not very sure what you are looking for. Adding an image over the panel that contains the scrollbar? If so, of course you can do it :)

Regards,
Leon If you need additional help, you can email to me at zaoliang@hotmail.com I don't guaranty that I will be able to solve your problems but I will try my best :)
 
My apologies for being so vague. And thank you for the prompt reply. Well, my first question is to resize the scrollbar. I would like to make the scrollbar longer I would say so it would look better than the stubby little scroll bar of 50 pixels. If I'm not mistaken, you said in your reply you cannot do that.

About the image over the location, I was trying to make the slider invisible and put a better looking image over the scrollbar. But since I cannot resize the scroll bar, it does not make sense to make the scroll bar look pretty... :(

If resizing (making it longer), does not work, then I guess I might have to go to swing.

Thanks again
 
Hi whodaman,

I'm really not a GUI expert, but I guess you can use ScrollPane in your situation.
Just check java.awt.ScrollPane.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top