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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.