总结:我知道他是一专多能型。很优秀~~~~~~~~~~~。好幸福啊
package com.a.b; import java.awt.Color; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JFrame; import javax.swing.JOptionPane; public class Window { public static void main(String[] args) { // final JFrame f = new JFrame("窗口的"); f.addWindowListener(new WindowAdapter() { // 这里没有那个方法 public void actionPerformed(WindowEvent e) {// 这里的参数f还非的是final型的 int userSelect = JOptionPane.showConfirmDialog(f, "确定要退出吗?", "你好", JOptionPane.YES_NO_OPTION); if (userSelect == JOptionPane.YES_NO_OPTION) { System.exit(0); } } }); f.setBackground(Color.green); f.setVisible(true); f.setSize(500, 500); f.setDefaultCloseOperation(3); } }