An appealing feature of Java is its graphics support, which enables you to visually enhance
your applications. We now introduce one of Java’s graphical capabilities—drawing lines.
It also covers the basics of creating a window to display a drawing on the computer screen.
First Drawing Application
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 DrawPanel, the 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.
This class was good , great instructions . It makes easier to visualize before you even see the diagram . xD
ReplyDelete