Page 210 - CTS - CSA TP - Volume 2
P. 210
COMPUTER SOFTWARE APPLICATION - CITS
// Adding window close event handling
f.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent windowEvent) {
System.exit(0);
}
});
}
// main method
public static void main(String args[]) {
// creating instance of TextExample class
TextExample awt_obj = new TextExample();
}
}
Output:
TASK 5: creating simple Application Form
import java.awt.*;
public class AwtApp extends Frame {
AwtApp() {
Label firstName = new Label(“First Name”);
firstName.setBounds(20, 50, 80, 20);
Label lastName = new Label(“Last Name”);
lastName.setBounds(20, 80, 80, 20);
195
CITS : IT & ITES - Computer Software Application - Exercise 116