Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

fixed element in gridbaglayout

 
Leandro Coutinho
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
not a gridbaglayout solution, but a nested flowLayout panel might be good enough

 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Leandro, please read this link on cross-posting: BeForthrightWhenCrossPostingToOtherSites
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> Leandro, please read this link on cross-posting: BeForthrightWhenCrossPostingToOtherSites

Thanks, another added to my personal 'ignore-in-future' list
 
Leandro Coutinho
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 423
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pete stein wrote:Leandro, please read this link on cross-posting: BeForthrightWhenCrossPostingToOtherSites

ok, I didn't know this politic
 
Rob Spoor
Sheriff
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic