Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/328.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 对话服务器芯片_Java_Swing_Jframe_Jdialog - Fatal编程技术网

Java 对话服务器芯片

Java 对话服务器芯片,java,swing,jframe,jdialog,Java,Swing,Jframe,Jdialog,我对JOptionPane.showInputDialog(…)方法(以及JJOptionPane的其他方法)有一种奇怪的行为。 创造的对话似乎永远不会消失。当我在对话框消失后调用Window.getWindows()时,窗口的数量增加了 测试这个程序,你就会明白我的意思: public static void main(String[] args) { final JFrame frame = new JFrame(); final JPanel panel =

我对JOptionPane.showInputDialog(…)方法(以及JJOptionPane的其他方法)有一种奇怪的行为。 创造的对话似乎永远不会消失。当我在对话框消失后调用Window.getWindows()时,窗口的数量增加了

测试这个程序,你就会明白我的意思:

public static void main(String[] args) {
        final JFrame frame = new JFrame();
        final JPanel panel = new JPanel();
        final JButton button = new JButton("Show Dialog");
        panel.add(button);
        frame.add(panel);
        button.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent ae) {
                JOptionPane.showInputDialog(frame, "Enter some text : ");
                System.out.println(Window.getWindows().length);
            }
        });
        frame.setSize(400, 400);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
}
有人能解释发生了什么事吗

有人知道会发生什么吗

Window.getWindows()
始终返回在
当前JVM
中创建的每个容器(不带容器返回
!isDisplayable
),这些容器从未从
JVM内存中消失,也从未被
GC'ed
,因为它们是作为资源从
本机操作系统中来的

有人知道会发生什么吗


Window.getWindows()
始终返回在
当前JVM
中创建的每个容器(不带容器返回
!isDisplayable
),这些容器从未从
JVM内存中消失,也从未被
GC'ed
,因为它们是作为资源从
本机操作系统中来的,

为什么
你会在答案中反勾选
东西
,那实际上不是编码?我们有
粗体
斜体
为什么
你在回答中反勾
东西
那实际上不是编码?我们有加粗的和斜体的。