why doesn't the frame close when i press the escape key?

后端 未结 4 1750
走了就别回头了
走了就别回头了 2021-01-18 09:53
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;


public class displayFullScreen extends JFrame {
        private JLabel alarmMessage = new JLabel(         


        
4条回答
  •  半阙折子戏
    2021-01-18 10:54

    The invocation of setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); does not close the frame, it will define the behaviour when the windows decoration [X] close button is pressed (Which you have disabled for full screen). You could replace this with setVisible(false); or exit your programm.

提交回复
热议问题