aspose file tools
The moose likes Swing / AWT / SWT and the fly likes ABSOLUTE LAYOUT/ NULL LAYOUT.. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "ABSOLUTE LAYOUT/ NULL LAYOUT.." Watch "ABSOLUTE LAYOUT/ NULL LAYOUT.." New topic
Author

ABSOLUTE LAYOUT/ NULL LAYOUT..

javamanish joshi
Greenhorn

Joined: May 05, 2007
Posts: 3
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

Joined: Jun 09, 2003
Posts: 4632
> ..the difference between ABSOLUTE LAYOUT and NULL LAYOUT ?

http://java.sun.com/docs/books/tutorial/uiswing/layout/none.html
javamanish joshi
Greenhorn

Joined: May 05, 2007
Posts: 3
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

Joined: Oct 13, 2005
Posts: 32654
    
    4
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

Joined: Oct 13, 2005
Posts: 32654
    
    4
. . . and welcome to the Ranch
rohit leeta
Ranch Hand

Joined: May 02, 2007
Posts: 49
I recommend GroupLayout which is introduced in Java6:

http://java.sun.com/docs/books/tutorial/uiswing/layout/group.html


<a href="http://www.java-forums.org" target="_blank" rel="nofollow">Java Forums</a>
javamanish joshi
Greenhorn

Joined: May 05, 2007
Posts: 3
thank..you all...
now will be regular to java ranch
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: ABSOLUTE LAYOUT/ NULL LAYOUT..
 
Similar Threads
Spreading out JLabels in a panel
which layout can position components at exact location
Changing JButton positions relative to screen size
Layout Question
layout manager