File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPanels with different content should have the same size

 
Kay Tracid
Ranch Hand
Posts: 148
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a problem with some panels. They have some buttons, textFields and so on. Thats why the size of the panels are different and it looks bad. If there is space left, the panel should be big as the biggest panels of all. I cant use an absolute Layout. So how can I make them the same size? I think it is a design question...
Please help
Thanks a lot
regards Kay
[ February 19, 2003: Message edited by: Kay Tracid ]
[ February 19, 2003: Message edited by: Kay Tracid ]
 
Paul Stevens
Ranch Hand
Posts: 2823
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
GridLayout. Not knowing how your screen looks doesn't help. If you can't use that for whatever reason. You could set the maximum size and minimum size to the same for all. They won't resize when you enlarge the window though.
 
Kay Tracid
Ranch Hand
Posts: 148
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have still the problem. can sombody help? here is the code:

[ February 22, 2003: Message edited by: Kay Tracid ]
 
Kay Tracid
Ranch Hand
Posts: 148
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
maybe the sourcecode helps to find a solution?
 
Kay Tracid
Ranch Hand
Posts: 148
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
could someone give me a hint please?
 
Paul Stevens
Ranch Hand
Posts: 2823
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried putting them in a GridLayout? You are using GridBagLayout in your code example.
 
Kay Tracid
Ranch Hand
Posts: 148
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i tried, but i failed. if i use gridlayout the label, textfield and button is centered in the middle. that looks bad.
 
Paul Stevens
Ranch Hand
Posts: 2823
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Real quick here is one way to do it.
 
Paul Stevens
Ranch Hand
Posts: 2823
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is another way of doing it. You would have to find the largest size if doing it this way.
 
Kay Tracid
Ranch Hand
Posts: 148
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot. I will try to use this way. I dont know the largest label, but I will try to find that out.
Thanks for your help
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic