That's My Code Down Here. I want the answer for java.awt.Button
and java.awt.Frame
.
Can any one help me with it?
import java.awt.*;
import java.awt.event.*;
public class TestGUI extends Frame implements ActionListener, WindowListener{
private Label lbl;
private Label lbl1
private Label lbl2;
private Label lbl3;
private TextField tf;
private TextField tf1;
private TextField tf2;
private Button btn;
private Button btn1;
private Frame frame;
public TestGUI() {
setLayout(new FlowLayout());
lbl = new Label("Hi Guys! That's My First GUI Program and is made by me too");
add(lbl);
lbl1 = new Label("Enter Your Name Please ~");
add(lbl1);
tf1 = new TextField(30);
tf1.setEditable(true);
add(tf1);
lbl2 = new Label("Enter Your Age Please ~");
add(lbl2);
tf2 = new TextField(30);
tf2.setEditable(true);
add(tf2);
lbl3 = new Label("Enter Your School/College Name Please ~");
add(lbl3);
tf = new TextField(28);
tf.setEditable(true);
add(tf);
btn = new Button("Cancel");
add(btn);
btn.addActionListener(this);
addWindowListener(this);
setTitle("My own GUI");
setSize(500, 300);
setVisible(true);
}
public static void main(String[] args){
TestGUI app = new TestGUI();
}
@Override
public void actionPerformed(ActionEvent evt){
}
@Override
public void windowClosing(WindowEvent evt){
System.exit(0);
}
@Override public void windowDeactivated(WindowEvent evt){}
@Override public void windowActivated(WindowEvent evt){}
@Override public void windowOpened(WindowEvent evt){}
@Override public void windowClosed(WindowEvent evt){}
@Override public void windowIconified(WindowEvent evt){}
@Override public void windowDeiconified(WindowEvent evt){}
}
Thanks in Advance.