13.8. The Frame Class

A Frame is the starting point for graphical applications and for pop-up windows in applets. Most often, a Frame is used to create a stand-alone window. A Frame has a title, menu bar, border, cursor, and icon image. Furthermore, a Frame is a container and can contain other GUI components.

Default LayoutManager: BorderLayout

The BorderLayout manager divides the screen into five regions: NORTH, SOUTH, EAST, WEST, and CENTER. Each region can contain at most one component, and you specify the region when adding the component to the window (e.g., add(component, BorderLayout.NORTH)). A component placed in the NORTH or SOUTH region is placed at the top or bottom of the frame, shrunk to its preferred height (see the preferredSize ...

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.