File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Gridbag layout problem, element comming in center Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Gridbag layout problem, element comming in center" Watch "Gridbag layout problem, element comming in center" New topic
Author

Gridbag layout problem, element comming in center

ujjval pandya
Greenhorn

Joined: Mar 30, 2008
Posts: 9
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

Joined: Jul 26, 2007
Posts: 10372
    
    8

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


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
ujjval pandya
Greenhorn

Joined: Mar 30, 2008
Posts: 9
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

Joined: Mar 30, 2008
Posts: 9
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

Joined: Jul 26, 2007
Posts: 10372
    
    8

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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Gridbag layout problem, element comming in center