File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes ScrollBar on a Frame ?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "ScrollBar on a Frame ??" Watch "ScrollBar on a Frame ??" New topic

ScrollBar on a Frame ??

Nicolas Viollin

Joined: Apr 13, 2001
Posts: 26
I would like to print a list of the fonts available on a system, with a exemple of each fonts in different sizes.
but how to set a scrollbar on a frame, and is it possible
maybe on a panel ???
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302

I assume you are using AWT because you just said frame and panel. I was using Swing, but should work the same. Here is what I did.
I created a JFrame then set a JPanel as it's contentPane. Then I created a JScrollPane and placed that on my JFrame. I then created another JPanel and placed it inside the JScrollPane. Be sure and set the JScrollPane Deminsions no larger than the JFrame, but the JPanel you place inside can be any size you want. Or you could use a JTextArea or whatever. Doesn't have to be a JPanel.
Hope that helps. If you need some code, let me know.

Happy Coding,
Gregg Bolinger

GenRocket - Experts at Building Test Data
Chantal Ackermann
Ranch Hand

Joined: Sep 28, 2000
Posts: 508
there is no ScrollPane for AWT. at least, Swing and AWT work quite different at this point. if you're not urged to use AWT, than use Swing. it's newer, better, buggylesser etc.
I agree. Here's the link:
subject: ScrollBar on a Frame ??
It's not a secret anymore!