The moose likes Swing / AWT / SWT / JFace and the fly likes JPanel Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT / JFace
Reply Bookmark "JPanel" Watch "JPanel" New topic
Author

JPanel

dubey vandana
Greenhorn

Joined: Nov 22, 2001
Posts: 14
hi,
I have 3 radiobuttons(rdb) named i1, i2, i3.
On clicking each of these rdbs, i have JPanel p1, p2, p3 poping up. All these JPanels are added to a common JPanel say, pp.
I want tht size of all panels p1, p2, p3 should be same even though the number of componenets added to each of then are different.
I used getSize() and setSize() but it does not work. when i click on i1, p1 has some size. Now i click on some other rdb and come back again and click on i1. now the size is different from the size which i got earlier.
pl help asap.
thanx
lavanya subramanian
Ranch Hand

Joined: Nov 03, 2000
Posts: 52
hi vandana,
i don't know what layout u got for the frame,make the frame's layout to null and panel.setBounds(new Rectangle(x,y,width,height)) for every panels and see if the size of each panel are same.
i worked it out and getting the same.

regards,
lavanya
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
You don't have to set it to null. You can use setPreferredSize() setMinimumSize() setMaximumSize().
Why don't you want them to resize? Why do they have to be the same size? Putting them into a grid layout might do the trick as well. Null layout is a real copout and looks like crap if you risize.
 
IntelliJ Java IDE
 
subject: JPanel
 
Threads others viewed
java.awt what is going on???
calling paint from another class
trouble with layouts
Rescalling JComponents
JScrollPane and JPanel in JSplitPane(Nested)
MyEclipse, The Clear Choice