Discussion Locked

Layout in Java

0 helpful
9 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
What is NULL layout in Java Language?

9 replies

by paragmehta

Null is not a layout...! Null is the unknown value...

If you are taking about
Component.setLayout(null) , then
It simply indicates that no layout Manager would be used and Alignment provided by us would take effect. Although it sounds lucrative at first, it can be headache for any project of sizable length...
Hope this help...

by vickydicky

I too of ur opinion that there is no layout like Null Layout , but I got this questoin in one test and I searched for this in book, but i didn't find any thing like "Null Layout". So I came to this board.
Sorry to say ur answer is not satisfied me.

by cwrobin6971

In most cases (I have seen various IDE's alter this) the use of 'Null' in the setLayout method causes the default layout manager to be used if no positions are stated for the added controls.

Typically this means that 'flowLayout' will be used unless the code specifies the coordinates for the control(s).

However, I have also seen the use of Null in setLayout cause one control to be placed upon another but I can't remember which development environment I was using at the time. (sorry)

by vimalsuresh

Null Layout is not a layout.But you can set the position for each and every component in the container by using setBounds() method.

by sinan

Hello

A "null" layout, means that u are not using what is called a "LayoutManager" in u'r panel/component..

What this means, that the responsibility for setting up certain widgets on the screen is u'rs (so u'll need to supply an x,y value, sizes etc..).. Whenever u'll need to drag the mouse and resize the window, the widgets will stay where they were, there is no hidden "intelligence" that for example rearranges the buttons to be prettier etc..

This discussion is closed to new replies.