Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Alignment in Flowlayout:

 
Narasimha Rao B.
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please see the question and answer.
How do you indicate where a component will be positioned using Flowlayout?
1) North, South,East,West
2) Assign a row/column grid reference
3) Pass a X/Y percentage parameter to the add method
4) Do nothing, the FlowLayout will position the component
Answer - 4.
My concern: Answer should be 1. Because Flowlayout class provides constructors which allow the alignment.
i.e. Flowlayout(int alignment)
and alignment value can be LEFT/CENTER/RIGHT.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you are supposed to recognize the north south east west words as being used for BorderLayout and thus not appropriate for FlowLayout.
Bill
 
Narasimha Rao B.
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi William,
Thanks for your reply. Sorry, my questions is wrongly framed, i will agree north south east west words should be used in Boarderlayout not in Flowlayout. But what is meant by keywords left,right and center used in Flowlayout to layout the component, can't we use these to position the component.
 
Francis Siu
Ranch Hand
Posts: 867
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi narasimha
My concern: Answer should be 1. Because Flowlayout class provides constructors which allow the alignment.
i.e. Flowlayout(int alignment)
and alignment value can be LEFT/CENTER/RIGHT.

I am sorry that the default Layout using the
1) North, South,East,West is BorderLayout and FlowLayout is LEFT/CENTER/RIGHT.
It can not be explained because it is written by development team in this Layout Manager
 
Francis Siu
Ranch Hand
Posts: 867
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi narasimha
I am grateful if you have any material about(JFC)or (Swing) related to MC in electronic version such as Front Page.
Could you send to me through email if you have.
thanks for your attention
Please reply,thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic