Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JPanel bounds with ScrollPane

Status
Not open for further replies.

eircom

Technical User
Feb 3, 2003
1
IE
Hi,
I'm drawing some stuff in a JPanel, while drawing, some of the things drawn are outside the size of the panel, I was hoping to use a ScrollPane to handle this. While drawing I try and change the bounds of the panel setSize() setBounds(). When I put the panel into the ScrollPane it never works. The size of the JPanel is always reduced to just less then the size of the ScrollPane so I loose everything outside the bounds.
HELP!!!
Thanks
 
Code:
class testing extends JFrame
{
   JPanel panel = new JPanel();
   JScrollPane sp = new JScrollPane(panel);
   sp.setPreferredSize(new Dimension(150,150));
   getContentPane.add(sp);
   .
   .
   .
}

should work. you can of course place the scrollpane 'sp' onto another panel instead of the jframe.

If it doesn't work, can we have a look at your code perhaps? -------------------------------------------
There are no onions, only magic
-------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top