This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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
subject: Making sure Scrollbars are visible
Similar Threads
JTable in a JScrollPane : no scrollbars!
Customised scroll bar within Div tag?
Making sure Scrollbars are visible
Scroll Bar Visibility
Problem with scrollbars in JList