O'Reilly logo

PURE Java™ 2 by Kenneth Litwak

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Absolute Positioning

Although it is not a recommended technique, because many IDE tools use absolute positioning, this will be covered first. Absolute positioning is a means of specifying the exact size and location of every GUI component by pixels. You do this when you tell Java not to do anything about the sizing or positioning of components. You take on that responsibility completely.

Using Absolute Positioning (No LayoutManager): Code Example

You need to do two things to use absolute positioning. First, remove any LayoutManager implementation object from the GUI by setting its object reference to null. Second, define the position, width, and height in pixels of every component in the GUI (except for a MenuBar, which has a predefined location ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required