Why am I getting java.lang.IllegalStateException "Not on FX application thread" on JavaFX?

I have an application that has a `TableView` that has an attached listener so it refreshes as soon as it detects a change, but the thing is that I´m getting `java.lang.IllegalStateException: Not on FX application thread; currentThread = Smack Listener Processor (0)`. Here is my code: /** * This function resets the pagination pagecount */ public void resetPage() { try { System.out.println("RESET"); int tamRoster = this.loginManager.getRosterService().getRosterList().size(); paginationContactos.setPageCount((int)(Math.ceil(tamRoster*1.0/limit.get()))); int tamEnviados = this.loginManager.getRosterService().getEnviadasList().size(); paginationEnviadas.setPageCount((int)(Math.ceil(tamEnviados*1.0/limit.get()))); int tamRecibidas = this.loginManager.getRosterService().getRecibidasList().size(); paginationRecibidas.setPageCount((int)(Math.ceil(tamRecibidas*1.0/limit.get()))); } catch (Exception e) { e.printStackTrace(); } } public void doSomething () { this.loginManager.getRosterService().getRosterList().addListener(new ListChangeListener() { @Override public void onChanged( javafx.collections.ListChangeListener.Change c) { // TODO Auto-generated method stub resetPage(); while (c.next()) { if (c.wasPermutated()) { System.out.println("PERM"); } else if (c.wasUpdated()) { System.out.println("UPD"); } else { System.out.println("ELSE"); } } } }); } Altough it enters the resetPage method, I get that exception. Why is this happening? How can I fix it? Thanks in advance.

以上就是Why am I getting java.lang.IllegalStateException "Not on FX application thread" on JavaFX?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏