我有一个简单的摆动窗口来加载文件。
这出现在类analyzedLoad
中,在一个函数中analyzedloads()
JFileChooser fc = new JFileChooser();
JFrame frame = new JFrame();
int returnVal = fc.showOpenDialog(frame);
frame.dispose();
if (returnVal == JFileChooser.APPROVE_OPTION) {
我在没有用户输入的情况下应用该功能,一切都很好。但是在我从用户那里得到输入的地方,以这种方式:
int al= 0;
Scanner in = new Scanner(System.in);
System.out.println("for choose file, press 1; for save, press 2");
al= in.nextInt();
if (al== 1){
analyzedLoad.analyzedloads(); // A static function which open the swing window
窗口不出现,进程继续运行,不做任何事情。
谢谢。