FileDocCategorySizeDatePackage
SwingExample.javaAPI DocExample866Tue Feb 12 13:32:04 GMT 2002myprojects.swingexample

SwingExample.java

/*
 * @(#)SwingExample.java 1.0 01/12/02
 *
 * You can modify the template of this file in the
 * directory ..\JCreator\Templates\Template_1\Project_Name.java
 *
 * You can also create your own project template by making a new
 * folder in the directory ..\JCreator\Template\. Use the other
 * templates as examples.
 *
 */
package myprojects.swingexample;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;

class SwingExample extends JPanel{
	
	public void paintComponent(Graphics g) {
		super.paintComponent(g);
		Dimension size = getSize();
		final int gap = 1;
		final int width = size.width-2*gap, height=size.height-2*gap;
		if((width > 0) && (height > 0)) {
			g.drawOval(gap,gap,width,height);
		}
	}
	
	public static void main(String[] args) {
		SwingExample s = new SwingExample();
	}
}