File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Null Layout Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Null Layout" Watch "Null Layout" New topic
Author

Null Layout

lakshmi nair
Ranch Hand

Joined: Oct 11, 2000
Posts: 63
What exactly is a null layout?
I came across such a question in http://www.jaworski.com/java/certification/ site.
It says you can position components in exact positions using a null layout.
sri devij
Ranch Hand

Joined: Oct 23, 2000
Posts: 37
If we set the layoutmanager to null and if we create components using this layout if we want to resize the window there won't be any effect on the components size & position..
But I think there is no null layout in JAVA2..It's there in the prev version
-shree
Originally posted by lakshmi nair:
What exactly is a null layout?
I came across such a question in http://www.jaworski.com/java/certification/ site.
It says you can position components in exact positions using a null layout.

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Iakshmi,
Using a null layout signifies that you don't use any Layout manager. To do that you must call <code>setLayout(null)</code> on your container and position your components "manually" by calling <code>setBounds(int x, int y, int width, int height)</code> or <code>setLocation(int x, int y)</code> and <code>setSize(int width, int height)</code> on each component.
The main drawback is that when you resize your container, all the components stay at the same place... you have to handle the dynamic layout management yourself ;-)
Hope this help,
Beno�t
SHALINI PATEL
Ranch Hand

Joined: Oct 31, 2000
Posts: 41
LAKSHMI if yu setlayout(null) u have to define the layout explicitly. But generally this is not helpful because it defies the concept of "DESIGN ONCE AND RUN ANYWHERE" I mean layout would be appearing differently on different platform and hence its not advisable.
hope this helps....
shalini
 
IntelliJ Java IDE
 
subject: Null Layout
 
Threads others viewed
Errata for Jaworski Guide
Is the jaworski
finally, passed..
Java 2 Certification All-in-One Exam Guide, 3rd Edition
developper certification!!!
MyEclipse, The Clear Choice