jQuery in Action, 3rd edition
The moose likes Beginning Java and the fly likes Making sure Scrollbars are visible Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Making sure Scrollbars are visible" Watch "Making sure Scrollbars are visible" New topic

Making sure Scrollbars are visible

Shyam Prasad Murarka
Ranch Hand

Joined: May 02, 2005
Posts: 209
Dear Readers,
I have added a JList to a JPanel with the help of a JScrollBar. But, when the list is either empty or too small, the vertical scrollbars dont appear. How do I make sure that they are visible everytime?

With Best Regards,
Shyam Prasad Murarka
marc weber

Joined: Aug 31, 2004
Posts: 11343

If you use a JScrollPane, then you can set the scrollbar policies using constants, VERTICAL_SCROLLBAR_ALWAYS and HORIZONTAL_SCROLLBAR_ALWAYS. (The defaults are "...AS_NEEDED.")

Moving this topic to the Swing forum.

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
I agree. Here's the link: http://aspose.com/file-tools
subject: Making sure Scrollbars are visible
It's not a secret anymore!