为什么isActive()
函数在windows中正常运行而在ubuntu中不能运行?我在下面的代码中使用了这个函数,使程序等待直到myFrame
JFrame窗口被关闭,这只在窗口中工作。
MyFrame myFrame = new MyFrame(); // This class Extends jFrame to show a Jframe
myFrame.run();
while (myFrame.isActive()) {
sleep(500); // this another function in this class to delay the program for 500 mS
}
为什么会发生这种情况,如何处理这种情况!?
事件线程外调用isactive
的问题。在myFrame类中使用事件监听器来处理非活动状态。