aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Expanding JPanel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Expanding JPanel" Watch "Expanding JPanel" New topic
Author

Expanding JPanel

abu alfouz
Ranch Hand

Joined: Nov 20, 2006
Posts: 44
Hi ..
I Have a JPanel inside JFrame, I need to expand this panel at run time without expanding the frame itself (maybe by using JScrollPane), the scrollpane didn't work and I have no other ideas .. can anybody help me?


SCJP 1.5
SCWCD 1.4
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> the scrollpane didn't work

it should.
post a sample program so we can se how you're doing it.
(just a frame with scrollpane and panel (panel with e.g. a JLabel))
abu alfouz
Ranch Hand

Joined: Nov 20, 2006
Posts: 44
Here is a sample:

Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
add this line

pnl.setPreferredSize(new java.awt.Dimension(800,600));
abu alfouz
Ranch Hand

Joined: Nov 20, 2006
Posts: 44
Thank you Micheal, it worked with:

pnl.setPreferredSize(new java.awt.Dimension(800,600));
pnl.setSize( 800, 600 );
[ May 19, 2007: Message edited by: abu_alfouz ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61653
    
  67

"abu_alfouz",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Expanding JPanel