• Post Reply Bookmark Topic Watch Topic
  • New Topic

ABSOLUTE LAYOUT/ NULL LAYOUT..  RSS feed

 
javamanish joshi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any body tell me the difference between ABSOLUTE LAYOUT
and NULL LAYOUT ?

also which plugin(open source) would be best for(AWT-SWING)
4 ecllipse ?


regards ,

Manish Joshi
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> ..the difference between ABSOLUTE LAYOUT and NULL LAYOUT ?

http://java.sun.com/docs/books/tutorial/uiswing/layout/none.html
 
javamanish joshi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks michael ,

but i have gone through that link before.Might be as i am still learning on swing , i am not able to decipher the difference there....

Instead , i got something . i don't know how much correct it is.

-----------------------------------------------

AbsoluteLayout is a LayoutManager that works as a replacement for "null" layout to allow placement of components in absolute positions. // from java.sun.com --- forum If you use NullLayout then you have to place each component by setting its x, y, width and height through the setBounds() method or similar, separately from adding it to the container. If you use AbsoluteLayout, then you can supply the bounds as you add the component to the container. Not much different really except AbsoluteLayout saves you one statement per component. think AbsoluteLayout does more than just setting Layout to null. AbsoluteLayout may even accomodate for changes in font sizes etc. . there are several different classes named AbsoluteLayout (ADF, SWT, BUI, samskivert.. Although we strongly recommend that you use layout managers, you can perform layout without them. By setting a container's layout property to null, you make the container use no layout manager. With this strategy, called absolute positioning, you must specify the size and position of every component within that container. One drawback of absolute positioning is that it does not adjust well when the top-level container is resized. It also does not adjust well to differences between users and systems, such as different font sizes and locales. frame.setLayout(null); // null layout absolute positioning
--------------------------------------------------------

It gives a general idea...but stillvery much bugged by the query.
 
Campbell Ritchie
Sheriff
Posts: 55351
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In null layout you have to supply locations for each component; useBounds() is probably the easiest way to do it.
AbsoluteLayout, which appears not to be part of the standard Swing/AWT API (I found this link; is it the same one you found earlier?) takes the setBounds() method of each component and puts the components in those locations.

I have never used absolute nor null layouts, but I would think AbsoluteLayout is probably a better option than null if that is the sort of layout you want.
 
Campbell Ritchie
Sheriff
Posts: 55351
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
. . . and welcome to the Ranch
 
rohit leeta
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I recommend GroupLayout which is introduced in Java6:

http://java.sun.com/docs/books/tutorial/uiswing/layout/group.html
 
javamanish joshi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank..you all...
now will be regular to java ranch
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!