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 ...

Get PURE Java™ 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.