Next: Layouts. Up: Composing GUIs. Previous: None.


The JPanel class

Textbook: Section 12.6

A JPanel object is an empty graphical component. It may seem weird that such a thing is worth talking about. But it is, for two reasons:

This last point is the reason we want to talk about panels today.

There are three JPanel methods that are particularly important.

JPanel()
Creates an empty JPanel.
void add(Component what)
Inserts what into the panel, using the default placement.
void add(Component what, Object info)
Inserts what into the panel, using info as information about where the object should be placed.


Next: Layouts. Up: Composing GUIs. Previous: None.