Hi guys I am writing a little program in java and it’s my first try at anything with an interface/picture.
It makes the frame for me but when I click the close button X, it doesn’t close it just treats it like nothing happened…any ideas?
class Graph extends Canvas{
public Graph(){
setSize(200, 200);
setBackground(Color.white);
}
public static void main(String[] args){
Graph gr = new Graph();
Frame aFrame = new Frame();
aFrame.setSize(300, 300);
aFrame.add(gr);
aFrame.setVisible(true);
}
Is that java.awt.Frame? I think you need to explicitly add the handler for so:
I used this source for so.
If it were swing it would be something like
jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)