Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JPanel  RSS feed

 
dubey vandana
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!