import java.awt.*;
import java.awt.event.*;
public class SimpleAWTExample {
public static void main(String[] args) {
// Create a Frame
Frame frame = new Frame("Simple AWT Example");
// Create a Button
Button button = new Button("Click Me!");
// Set layout for the Frame
frame.setLayout(new FlowLayout());
// Add the Button to the Frame
frame.add(button);
// Set size of the Frame
frame.setSize(300, 200); // Width: 300 pixels, Height: 200 pixels
// Make the Frame visible
frame.setVisible(true);
// Add a WindowListener to handle closing event
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
}
}