• Post Reply Bookmark Topic Watch Topic
  • New Topic

Which Layout is best in java for placing components at a particular position

 
Vijraj Bhargav
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am using absolute positioning in my code. means using null layout. but it has some problems. in different laptop screens my whole code becomes useless. what should i use in place of null layout so that my components positions remain same in any laptop screen. please tell me the best layout to position components at particular positions. Thanks..
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Like you have already found out, absolute and precise positioning is a bad idea. Layouts are designed to help you place the components in a relative position (e.g. top left, or in a grid of 3 rows and two columns)
To achieve your desired layout, you can pick from the multiple built in layouts (or create your own). Usually you would identify a pattern in your UI design and use nested layouts. More on using layouts here http://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!