• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Gridbag layout problem, element comming in center

 
ujjval pandya
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to add child JPanel dynamically in parent JPanel using grid layout in JFrame.

When ever i add componenet, it comes in the center only.Then i set the weighty=1. Now first compoenet is comming on top, rest all are added at the bottom.

One more thing, All the child elmenet should be of same size, and it should not cover the entire remaining area. How can i set a constraints, so that each child panel are added one after the other from top to bottom?Please help. It is really urgent.

Thanks in advance !
 
Maneesh Godbole
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Weightx and weighty are the attributes used with the GridBagLayout. You mentioned GridLayout. Which one are you really using.

You might find this useful
http://www.horstmann.com/articles/Taming_the_GridBagLayout.html

Also google for MigLayout. You might want to consider it in place of GridBagLayout
 
ujjval pandya
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:Weightx and weighty are the attributes used with the GridBagLayout. You mentioned GridLayout. Which one are you really using.

You might find this useful
http://www.horstmann.com/articles/Taming_the_GridBagLayout.html

Also google for MigLayout. You might want to consider it in place of GridBagLayout


Opps, Its only GRID BAG LAYOUT only!!!
my mistake.sorry.

 
ujjval pandya
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:Weightx and weighty are the attributes used with the GridBagLayout. You mentioned GridLayout. Which one are you really using.

You might find this useful
http://www.horstmann.com/articles/Taming_the_GridBagLayout.html

Also google for MigLayout. You might want to consider it in place of GridBagLayout


Is it not possible with grid bag layout? The link you gave is not useful in this case.
Any other help ...

its urgent...
thanks in adavance ,..
 
Maneesh Godbole
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Relax! All of us are volunteers here and nobody really gets paid !
http://faq.javaranch.com/java/EaseUp
http://faq.javaranch.com/java/PatienceIsAVirtue

You have not posted your code and you think the link is not useful. Very difficult for us to figure out the problem on that input isn't it?

Why don't you post your sscce code so we can take a look?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic