• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Difference Between FlowLayout and GridLayout

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

Could you please any one expain me about difference between GridLayout and FlowLayout?



centerPanel.setLayout(new FlowLayout(FlowLayout.LEFT))

centerPanel.setLayout(new GridLayout(0,6,5,5))


I used 2nd line with GridLayout instead of 1st line's FlowLayout.

Can i use same FlowLayout instead of GridLayout?
Because it does not work some time properly.



With Regards,
Kalai.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Learn all about layouts: http://download.oracle.com/javase/tutorial/uiswing/layout/index.html
 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

kalai arasan wrote:Can i use same FlowLayout instead of GridLayout?


You can use whichever you want, but they do different things. A GridLayout puts all the components in a grid and forces them all to the same size. If that's what you need, you should use it. If it's not....
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is like asking what the difference between an apple and a pear is. Both are fruits, both grow on trees, but that's about it.

Edited stupid typo...
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you posted an example of the differences a month ago

https://coderanch.com/t/549726/GUI/java/Re-GridLayout-Buttons

have you been asleep?
 
kalai arasan
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


It was working fine with GridLayout,
suddenly in production some irrespective responsibility is coming here on this.

thats why i posted.


any way thanks for your comments ,


With Regards,
Kalai.
 
Darryl Burke
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What's "irrespective responsibility"?
 
reply
    Bookmark Topic Watch Topic
  • New Topic