我有一个主窗口,当我按一个按钮时,另一个窗口将打开。一定时间后,该窗口应关闭。因为它扩展了,所以stage我用super.close,但是不起作用。我能做什么?可能是因为我在服务任务中关闭了它导致的吗?public Game(int width, int height, int time) { this.width = width - 15; this.height = height - 15; this.time = time; this.layout = generateLayout(); this.scene = new Scene(this.layout, this.width, this.height); super.initModality(Modality.APPLICATION_MODAL); super.setScene(scene); super.setResizable(false); super.setTitle(TITLE); this.cicle.reset(); this.cicle.start(); super.showAndWait();}在cicle我的电话里close()有点困惑,但这是cicle服务任务:Service<Void> cicle = new Service<Void>() { @Override protected Task<Void> createTask() { return new Task<Void>() { volatile boolean waiting = false; @Override protected Void call() throws Exception { Timer.start(); while (Timer.update() / 1000 < time) { System.out.println(Timer.update()) } close(); return null; } }; }};
添加回答
举报
0/150
提交
取消