• Post Reply Bookmark Topic Watch Topic
  • New Topic

jScrollPane is disabled

 
micheal bevan
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why jscrollPane is disabled when I set the layout of child jpanel to null ?
 
Darryl Burke
Bartender
Posts: 5155
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Michael, and welcome to the Ranch!

How do you know it's disabled? Does getEnabled() return false?
 
Rob Camick
Ranch Hand
Posts: 2701
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why jscrollPane is disabled when I set the layout of child jpanel to null ?


Scrollbars appear automatically when the preferred size of the component added to the scrollpane is greater than the size of the scrollpane.

When you set the layout to null the component has a preferred size of 0, so there is no reason to show the scrollbars.

Do Not, set the layout to null. Swing was designed to be used with a layout manager so all components will work as expected.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!