0
我有一个主舞台是我的登录 FXML在这个阶段有一个地区,并与物业调用setVisible一个ProgressIndicator(假)JavaFX的螺纹锁固系统
后成功登录到应用程序的意图是以下几种观点这个区域和ProgressIndicator在一个线程启动应用程序的时候,但是会发生的事情是,在线程开始旋转加载应用程序之后,Region和ProgressIndicator不可见。
我的主题
Task t = new Task() {
@Override
protected Object call() throws Exception {
Platform.runLater(() -> {
try {
new SisgeFX().start();
} catch (IOException ex) {
Logger.getLogger(LoginController.class.getName()).log(Level.SEVERE, null, ex);
}
});
return null;
}
};
region.visibleProperty().bind(t.runningProperty());
pi.visibleProperty().bind(t.runningProperty());
Thread th = new Thread(t);
th.start();
我试图使两个线程一个引导系统,另一个更新ProgressIndicator
而没有加载系统,但没有成功,不产生Excepetion
,已经在尝试几种方法。
我在几次试图实现什么:
1 - 一个线程并开始和其他不(只启动加载系统中的线程)。
2 - 线程无法启动。
3 - Tread开始,但ProgressIndicator被锁定,它不是animanda。
摘录登录:
@FXML
private void sysLogin() {
String user = ctfUserLogin.getText();
String pass = ctfPassLogin.getText();
LoginDAO loginDAO = DAOFactory.make(LoginDAO.class);
Login login = loginDAO.getLogin(user, pass);
if (login != null) {
runThread(); // aqui chamo a Thread postado acima.
ctfPassLogin.setStyle(null);
ctfUserLogin.setStyle(null);
} else {
ctfPassLogin.clear();
ctfUserLogin.clear();
ctfPassLogin.setStyle("-fx-border-color:red;");
ctfUserLogin.setStyle("-fx-border-color:red;");
//new ShakeTransition(vBox).play();
new WobbleTransition(vBox).play();
//new TadaTransition(vBox).play();
}
}
如何显示ProgressIndicator在系统加载?
存在着类似的问题:http://stackoverflow.com/questions/27090426/progressbar-in-javafx-does-not-update-in-onaction-block/27092945#27092945。也许这有助于...... – 2014-11-25 17:02:04
谢谢,但不适合我。 – DOM 2014-11-26 09:24:49