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
posted
0
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
posted
0
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
posted
0
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