/** A very simple example of a Java GUI application
**/
// AWT components and Event classes used:
import java.awt.Button;
import java.awt.Frame;
public class SimpleGUI {
private Frame appFrame = null;
private Button doSomethingButton = null;
public static void main(String[] args) {
SimpleGUI app = new SimpleGUI();
app.run();
}
/** Constructor: make a frame to hold the GUI components and the
** GUI components themselves.
**/
public SimpleGUI() {
appFrame = new Frame("Simple Java GUI");
doSomethingButton = new Button("Do Nothing");
appFrame.add(doSomethingButton);
}
/** run the application
**/
public void run() {
appFrame.validate();
appFrame.setVisible(true);
}
}
|