• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Show a running circle while waiting and not block the whole app

 
Ranch Hand
Posts: 234
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let the user continue working while waiting for a long running database operation to return the dataset
How do I display the "running circle" while that operation is executing?
I want the user to be able to tab to other JavaFX tabpanes and work on something else.
 
Marshal
Posts: 69411
276
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you find any tutorials about progress bars? If you are using FX, then this tutorial won't help you a lot.

Not a beginning topic: moving to our databases and FX fora.
 
Ranch Hand
Posts: 127
7
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The keyword here is "decoupling" and failing to do it correctly is a common beginner issue wich lead to your mentioned "locking up of the whole application".
It comes down to how GUIs in Java work (keyword "EDT" - Event Dispatch Thread) and that beginners often not correctly understand why they need to run their code in a different thread than where the event is triggert.
Just by experience I guess your code looks a bit like this: You have some listener wich reacts to some event triggert by some button or alike and then, as the query takes time, your application becomes unresponsive. That's because you most likely locking up the EDT wich needs to always run clean by itself to keep the UI responsive. Care must also be taken when you want to update your GUI after your task has finished: You have to re-inject anything modifying the GUI back into the EDT. In Swing this is done with SwingUtilities.invokeLater(). FX should have something similar.
 
Campbell Ritchie
Marshal
Posts: 69411
276
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I remember correctly, a call to Application#launch() starts the corresponding th‍read in FX. You are liable to find FX applications crash with exceptions if you try to run anything on the wrong thre‍ad.
 
Sheriff
Posts: 7108
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The method you're looking for is called Platform.runLater().  Give me a second and I'll find some example code, or you can google javafx platform.runlater.
 
Knute Snortum
Sheriff
Posts: 7108
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
AhFai Chan
Ranch Hand
Posts: 234
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, these hints are like Aurum for me
 
Roses are red, violets are blue. Some poems rhyme and some don't. And some poems are a tiny ad.
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic