Johanna
Johanna

Reputation: 27660

what does frame.setLayout(null)do?(frame is a JFrame)

I have seen this in a slide but I couldn't get that when and why we use this?

Upvotes: 0

Views: 24931

Answers (2)

camickr
camickr

Reputation: 324147

Why don't you start by reading the Swing tutorial? There is a section that explains all about Layout Management as well as well what "absolute positioning" is. It also explains when you would use abolute positioning versus using a layout manager.

Generally the only time you would use it is when you need to support drag components to a random position.

The tutorial also has lots of other basic examples of using Swing components.

Upvotes: 3

duffymo
duffymo

Reputation: 308938

null layout means absolute positioning - you have to do all the work in your code. No layout manager to help you out.

Upvotes: 3

Related Questions