• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ScrollPane in TabbedPane

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I have a scrollPane in a tabbedPane. The scrollPane shows the scroll bar if i set the scrollPane's layout to null, but doesn't show the panel in it.
If I don't set the scrollPanes layout I see the panel in it, but no scroll bar.



If I uncomment the optionsPanel.setLayout(null); I'll see the panel.
As it is above I just see the scroll bar and no panel.

I'm not familiar with scrollPanels. Any ideas? Thanks
 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JScrollPane uses the preferred size, not the actual size.
 
Matt Bell
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, still having some problems

do you mean preferedSize of the JPanel, or the ScrollPane or both?
Should I use setSize as well as preferedSize also?

Many Thanks
 
Rob Spoor
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The JPanel. You should rarely need to call setSize on anything other than windows (JFrame, JDialog). All other component sizes are usually controlled by the layout manager of their parents. In this case, the JScrollPane and its JViewport will take care of sizing the JPanel.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic