Our first drawing application simply draws two lines. Class
DrawPanel (Fig. 4.18) performs the actual drawing, while class
DrawPanelTest (Fig. 4.19) creates a window to display the drawing. In class
import statements in lines 3–4 allow us to use class Graphics (from package
java.awt), which provides various methods for drawing text and shapes onto the screen, and class JPanel (from package
javax.swing), which provides an area on which we can draw.