Posted By:
Christopher_Schultz
Posted On:
Tuesday, April 3, 2001 07:42 AM
When you stick something into a JScrollPane, scrollbars only appear by default if the contained widget is bigger than the JScrollPane. So, if you have a 100x100 JScrollPane and a 50x50 JPanel inside of it, you get no scrollbars.
You will probably have to explicitly set the size of the JPanel before you place it inside of the JScrollPane.
If you want to force the scrollbars to be visible no matter what, you can call JScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS) and the similar method for the vertical scrollbar. You can also specify those attributes of the JScrollPane in one of the constructors.
-chris