• Post Reply Bookmark Topic Watch Topic
  • New Topic

ScrollPane in TabbedPane  RSS feed

 
Matt Bell
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • 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
 
Rob Spoor
Sheriff
Posts: 20895
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • 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
  • 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: 20895
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • 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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!