permaculture playing cards
The moose likes Swing / AWT / SWT and the fly likes JScrollPane not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JScrollPane not working" Watch "JScrollPane not working" New topic

JScrollPane not working

Manoj Paul
Ranch Hand

Joined: Jan 18, 2007
Posts: 112
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"

Brandon Broschinsky
Ranch Hand

Joined: Aug 21, 2004
Posts: 41
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
I agree. Here's the link:
subject: JScrollPane not working
jQuery in Action, 3rd edition