I'm working in Java AWT and when the window appears, I don't know how to close it. I try to Alt+F4 or use
[setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)] but this function wasn't called in Eclipse.
Eclipse IDE version 2018-12.
package test2;
import java.awt.Button;
import java.awt.Frame;
import javax.swing.JFrame;
public class java12 extends Frame{
public java12() {
setTitle("Demo Java AWT");
Button object=new Button("Click me");
object.setBounds(100, 100, 100, 100);
add(object);
setSize(90, 30);
setLayout(null);
setVisible(true);
}
public static void main(String[] args) {
new java12();
}
}
It only can close by Task Manager, how can I close it by put something in my code