• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JScrollPane not working

 
Manoj Paul
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello friends..

In my application i put a JScrollPane, in the JScrollPane is a JPanel, on the JPanel are thumbnails views of many images with the help of ImageIcons for which i used array of JLabels... Every thing is fine working... I can view all the thumbnails of any directory, but my directory may contain many numbers of image files for which i need the JScrollPane to work properly... and its not working, the JScrollPane doesnt show any vertical or horizontal bar.. i dont know why... i tried many options but all in vain... please help..

"A Friend In Need Is A Friend INDEED"

Thanks
 
Brandon Broschinsky
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The size of your JScrollPane needs to be smaller than the size of your JPanel, try to set the preferred, maximum, sizes of you JScrollPane. You can also compute the size of you JPanel, i.e. the size your images use when displayed, and override the getPreferredSize method of the jpanel to return the actual size of the JPanel.

for more information take a look at this.

How to Use Scroll Panes
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic