Tuesday, September 8, 2015

creating simple drawing in java


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.
















 

1 comment:

  1. This class was good , great instructions . It makes easier to visualize before you even see the diagram . xD

    ReplyDelete