©1994-2003 Kevin Boone
Home     Section index     K-Zone home Simple Java programs

Site search

Glossary
Confused by computer jargon? Look it up!

Shameless plug


Now available!

Articles
- Ten-minute guide to setting up a WAP site

- Talk like your boss: new developments in managerese

More...

Development
File handling in the Linux kernel

Java development for the Sony-Ericsson P800

SunONE Application Server 7 FAQ

More...

Linux
Using Linux with the Treo 600

- Linux on the Tecra M1

- Some notes on openzaurus

More...

Download
Java stuff

Linux stuff

More...

(Please read the download policy)

Home automation
The X10 system

Linux TW723 driver

More...

The K-Zone
K-Zone computing

K-Zone law

K-Zone education and science

K-Zone motorcycles

K-Zone DIY

K-Zone railways

K-Zone martial arts

About the author

K-Zone home page

 
Software development
Computing
Hello1.java
Add1.java
Add1_1.java
AwtTest.java
Button1.java
Button2.java
Calculator.java
CalculatorApp.java
ClockApplet.java
CountSpace1.java
DateTime.java
Div1.java
Factorial1.java
Factorial2.java
FontChooser.java
IfTest.java
Inheritance1.java
Loan.java
DiceThrower.java
MultiplicationTable.java
Queue.java
Reverse1.java
SoundApplet.java
Stressometer.java
TextReaderTest.java
WebMerge.java
Zener.java
`DoNothing' example program: an application that does nothing (used to embed applets)

DoNothing.java

/*
DoNothing.java

A stand-alone Java program that does nothing! This can be used as the outline
for a `real' Java application

Kevin Boone, September 1999
*/

import java.awt.*;
import java.awt.event.*;

/*
MainWindow

This class defines the main window for the application. It is
defined to implement WindowListener so that it can receive
window events from the user interface
*/

class MainWindow extends Frame implements WindowListener
{
public MainWindow()
	{
	// In the constructor we set the size and caption of the
	//  window, and specify `this' as the window listener
	super("Do-nothing program");
	setSize(300, 300);
	addWindowListener (this);
	}

// These operations are specified by the WindowListener interface so
//  we must include them. However, they don't do anything in this
//  do-nothing program
public void windowClosed (WindowEvent e) {}
public void windowOpened (WindowEvent e) {}
public void windowDeiconified (WindowEvent e) {}
public void windowIconified (WindowEvent e) {}
public void windowDeactivated (WindowEvent e) {}
public void windowActivated (WindowEvent e) {}

/* 
windowClosing

This operation is called in response to a windowClosing event. It should
simply exit the program
*/
public void windowClosing (WindowEvent e)
	{
	System.exit(0);
	} 

}

/*
DoNothing
This is the program's primary class. All it does is supply a 
`main' operation which creates a new main window
*/

public class DoNothing
	{
	public static void main (String args[]) 
		{
		MainWindow mainWindow = new MainWindow();
		mainWindow.setVisible(true);
		}
	}