java中 怎么控制一个 弹出框 右上角的关闭按钮的。

如题所述

该关闭按钮与窗口适配器WindowAdapter有关,WindowAdapter中有一个方法:windowClosing(WIndowEvent e){}。该方法用于当鼠标点击关闭按钮,就会执行方法windowClosing(WindowEvent e)中的语句。
温馨提示:内容为网友见解,仅供参考
第1个回答  2013-08-29
点击关了就关了,不需要写什么,判断是否点了关闭var n = window.event.screenX - window.screenLeft; var b = n > document.documentElement.scrollWidth - 20; </SPAN></li> if (b && window.event.clientY < 0 || window.event.altKey) </SPAN></li> { alert('onclick window close'); </SPAN></li> }
第2个回答  2013-08-29
setDefalutCloseOperation(JFrame.EXIT_ON_CLOSE)
相似回答