13.12. The Window Class

Window is the underlying class that Frame is built upon. A Window is used less frequently than the other window types and mainly serves to create pop-up windows with no border or title bar.

Default LayoutManager: BorderLayout

This layout manager divides the screen into five regions: NORTH, SOUTH, EAST, WEST, and CENTER. See the discussion of BorderLayout in Chapter 12 (Layout Managers).

Creating and Using a Window

When creating a Window, you can explicitly state the size of the Window through setSize or let the size of the Window be determined by the Components that the Window is holding. We show both approaches below.

To create a Window with a fixed size:

 // Create the Window. Window window = new Window(parentFrame); ...

Get Core Web Programming, Second Edition 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.