Home > Back-end >  System.exit(0); Click to exit the x have no reaction, please give the solution
System.exit(0); Click to exit the x have no reaction, please give the solution

Time:10-10

Package com. Xiaoyu;
import java.awt.*;
Import the Java. The awt. Event. WindowAdapter;
Import the Java. The awt. Event. WindowEvent;

Public class MygameFrame extends Frame
{

Public void launch ()
{

Enclosing setTitle (" window ");//initialize window
SetVisible (true);//window is visible

SetSize (500500);//window size

SetLocation (400400);//window open position
//add close the window of action
Enclosing addWindowFocusListener (new WindowAdapter ()
{
@ Override
Public void windowClosing (WindowEvent e)
{
System.exit(0);//normal exit program
}
});
}

Public static void main (String [] args)
{
MygameFrame game=new MygameFrame ();
Game. The launch ();
}
}

CodePudding user response:

O bosses give a solution

CodePudding user response:

Has been solved, code wrong, embarrassed,
  • Related