Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Making sure Scrollbars are visible

 
Shyam Prasad Murarka
Ranch Hand
Posts: 209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic