mainGUI.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);Intellij代码分析:
警告:(33,46)必须是: WindowConstants.DO_NOTHING_ON_CLOSE,WindowConstants.HIDE_ON_CLOSE,WindowConstants.DISPOSE_ON_CLOSE,WindowConstants.EXIT_ON_CLOSE
那么,使用WindowConstants.EXIT_ON_CLOSE比使用JFrame.EXIT_ON_CLOSE更好吗?
为什么?
发布于 2016-01-30 04:46:30
这两个选项是same.As,您可以看到setDefaultCloseOperation()方法将整数值作为参数,因此如果传递WindowConstants.DISPOSE_ON_CLOSE或JFrame.DISPOSE_ON_CLOSE,则相同。
https://stackoverflow.com/questions/35098029
复制相似问题