dcsimg
Unable to get the scrollbar for a JPanel
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Mir_Taqeeulla
Posted On:   Tuesday, June 26, 2007 10:39 AM

am using a single JPanel to add the components but am
getting the scrollPane but not the scrollbar in that,
even though the size of the contents in the panel go
beyond the initialized size of the frame.Can anyone
help me in this regard. Thanks in advance.

Re: Unable to get the scrollbar for a JPanel

Posted By:   ramanujam_ragavan  
Posted On:   Tuesday, June 26, 2007 02:04 PM

I have not looked at your code. So some basic questions,...

  1. Have you created a JScrollPane and added your panel to it?

  2. Have you set the layout of the panel to null?

  3. Have you forcefully set the preferred size of the panel to restrict it to some size?





I would tyically do something like this...



JPanel panel = new JPanel();

panel.add (.....);

panel.add (.....);

panel.add (.....);

panel.setLayout(new XYZLayout()); //any layout

JScrollPane pane = new JScrollPane
(panel,JScrollPane.,JScrollPane.);
...



If you could post some code, it would be easier to find why it doesn't work...



Hope it helped
About | Sitemap | Contact