gpt4 book ai didi

java - 方法 `actionPerformed()` 被执行多次(多于可数)

转载 作者:行者123 更新时间:2023-11-29 04:50:22 25 4
gpt4 key购买 nike

<分区>

while(b==true){
if((!tf.getText().equals("")) ){
System.out.println("outside actionPerformed");
p.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
System.out.println("Hello");
ne.remove(p);
ne.revalidate();
ne.repaint();
System.out.println("why"+EventQueue.isDispatchThread());
b=false;
System.out.println(b);
}
});
}
}

actionPerformed() 中的任何内容都会被执行多次。它应该只执行一次。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com