Yes.
Although you could draw directly on the JFrame
, it is more convenient to draw on a JPanel
.
Put the JPanel
in the JFrame
and draw on the JPanel
.
Think of a JPanel
as a sheet of paper that represents the drawing surface of the frame.
Think of the JFrame
as a picture frame around the sheet of paper.
A JPanel
is a container object that can be drawn on and can contain other AWT components.
A JPanel
is a rectangle width pixels across and
height pixels in height.
A location in the rectangle is described as
(X, Y) where X and Y are integers.
The (0, 0) location is at the top left.
Columns are numbered 0 to width-1 starting at the left. Rows are numbered 0 to height-1 starting at the top.
Does a JPanel
include close and minimize buttons?