*
The moose likes Swing / AWT / SWT and the fly likes fixed element in gridbaglayout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "fixed element in gridbaglayout" Watch "fixed element in gridbaglayout" New topic
Author

fixed element in gridbaglayout

Leandro Coutinho
Ranch Hand

Joined: Mar 04, 2009
Posts: 417
Hi!

I want the components of the GUI on the top-left and I don't want them to move to right when the window is resized.



Thanks.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
not a gridbaglayout solution, but a nested flowLayout panel might be good enough

pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
Leandro, please read this link on cross-posting: BeForthrightWhenCrossPostingToOtherSites
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> Leandro, please read this link on cross-posting: BeForthrightWhenCrossPostingToOtherSites

Thanks, another added to my personal 'ignore-in-future' list
Leandro Coutinho
Ranch Hand

Joined: Mar 04, 2009
Posts: 417
Thanks Michael Dunn
Don't you like to use direct in the frame?
eg:
why did you do this:
JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT));
p.add(gbPanel);
frame.add(p);

instead of this:

frame.setLayout(new FlowLayout(FlowLayout.LEFT));
frame.add(gbPanel);

I always have this doubt, if it is better put the components in a panel and then in the frame, or if I can put direct in the frame.
you that have much knowlodge, what do you recomend? do you have some tip?

I could manage to resolve this problem without the workaround.
Leandro Coutinho
Ranch Hand

Joined: Mar 04, 2009
Posts: 417
pete stein wrote:Leandro, please read this link on cross-posting: BeForthrightWhenCrossPostingToOtherSites

ok, I didn't know this politic
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19649
    
  18

Leandro Coutinho wrote:
pete stein wrote:Leandro, please read this link on cross-posting: BeForthrightWhenCrossPostingToOtherSites

ok, I didn't know this politic

Then perhaps http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch is a good read for you.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: fixed element in gridbaglayout
 
Similar Threads
how to set this a borderq
static reference variable in GUI
GridBagConstraints Problem
? File I/O (and-or) for each loop
make the last button align horizontally with other components