Online Software Educational Training - IT Tutorials - Online Education Training for Computer Software


Home

JAVA APPLET

Working with Graphics

The AWT supports a rich assortment of graphics method. All graphics are drawn relative to a windows. This can be main windows of an applet, or a stand-alone application window. The origin of each windows is at the top-left corner and is 0,0. 

A graphics context os encapsulated by the Graphics class and is obtained in two ways:

  • It is passed to an applet when one of its various methods, such as pain(), or update(), is called
  • It is returned by the getGraphics() method of Component.

The Graphics class defines a number of drawing functions. Each shape can be drawn edge-only or filled. For examples : Line, Circle, Arcs, Rectangle etc.


Previous

Next