//Name: Taunya Smith
//Date: June 7, 2005
//Class: CSC 220
//Write a GUI application which generates a window
//which looks like the following (and be sure to
include
//a window-capture of your output via )
import java.awt.event.*;
import java.awt.*;
public class Homework2 extends Frame{
private Button b1;
public Homework2(){
//Sets the layout to "Flow" Layout, so things don't stack
setLayout(new FlowLayout());
//show's the box
show();
//adds a button called Ok
add (b1 = new Button("Ok"));
//creates/ adds a label called New Label
Label lbl = new Label ("New Label");
add(lbl);
//creates/ adds a new textfield called Add your text here
TextField tf = new TextField("Add your text here");
add(tf);
//closes window
this.addWindowListener (new WindowAdapter(){
public void windowClosing (WindowEvent e) {
System.exit(0);
}
});
}
//calls main class
public static void main (String argv[]) {
new Homework2();
}
}
//}