provided by: 
Originally published at Internet.comRecently, while I was doodling with Java code, I wrote this simple tool for drawing basic geometric shapes. This tool is written using AWT components and elaborates features such as inner classes, event handling, polymorphism, and menu handling. In this article, we will step through the code chunk by chunk to build our simple drawing tool.
Step 1: An Empty Class Structure
First, we start with an empty class structure and we extend/inherit it from java.awt.Frame class. We set the frame's title and size and make it visible.
//Title: A Simple Drawing Tool //Version: 1.0 //Copyright: Copyright (c) 2001 //Author: Yasir Feroze Minhas //Company: KAPS Computing (pvt) Ltd. //Description: This is a simple tool written using AWT for drawing basic shapes. package graph; import java.awt.*; public class SimpleDrawingTool extends Frame{ public SimpleDrawingTool() { //set frame's title super("Simple Drawing Tool"); //set frame size this.setSize(400, 400); //make this frame visible this.setVisible(true); } public static void main(String[] args) { SimpleDrawingTool simpleDrawingTool = new SimpleDrawingTool(); } }
Step 2: Adding Menus
...
Read article at Internet.com site