JavaFX have ProgressMonitorDialog like jface? ProgressIndicator don't help.

javaFX have ProgressMonitorDialog like jface? ProgressIndicator don't help.
I need a loading page like ProgressMonitorDialog in jface.
Then when i do some time-consuming operation, a loading page will be loaded until the operation is over.
The problem is that when i use a Service class, i must put the time-consuming operation outside the Platform.runLater(new Runnable().
and i must put the javaFX controls set operation in the Platform.runLater(new Runnable(), it's very difficult to seperate them sometimes.
ProgressIndicator doesn't help in this case.
Thank you.
     button.setOnMouseClicked(new EventHandler<MouseEvent>() {
               public void handle(MouseEvent me) {
                    stage.show();
                    final Task<Integer> task = new Task<Integer>()
@Override
protected Integer call()
throws Exception
// TODO Auto-generated method stub
System.out.println("ssss");
try
Thread.sleep(5000);
catch (InterruptedException e)
// TODO Auto-generated catch block
e.printStackTrace();
Platform.runLater(new Runnable()
@Override
public void run()
                                   // when do something time-consuming here, then stage.Show(); above can't be loaded immediately when button clicked //,why? The thread will always wait the time-consuming operation.
button2.setText("dddddddd");
stage.close();
// TODO Auto-generated method stub
return null;
                    Service<Integer> service = new Service<Integer>()
@Override
protected Task<Integer> createTask()
// TODO Auto-generated method stub
return task;
service.start();
                    }});

>
I need a loading page like ProgressMonitorDialog in jface.
Then when i do some time-consuming operation, a loading page will be loaded until the operation is over.
The problem is that when i use a Service class, i must put the time-consuming operation outside the Platform.runLater(new Runnable().
and i must put the javaFX controls set operation in the Platform.runLater(new Runnable(), it's very difficult to seperate them sometimes.Use the various update(...) methods in the Task class, such as updateProgress(...). These will cause changes to the Task (and Service) properties, and these changes will be made on the FX Application thread for you.
You can also listen for changes to the state property of the service, or use the various utility methods such as setOnSucceeded(...) to execute code when the service finishes running. Again, these methods are executed on the FX Application thread, so you don't need to manage the Platform.runLater(...) yourself.
ProgressIndicator doesn't help in this case.Why not?
There are lots of examples out there. Here's another one :)
import javafx.application.Application;
import javafx.beans.binding.Bindings;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.concurrent.Service;
import javafx.concurrent.Task;
import javafx.concurrent.Worker.State;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ProgressIndicator;
import javafx.scene.layout.BorderPane;
import javafx.stage.Modality;
import javafx.stage.Stage;
public class ProgressDialogDemo extends Application {
  @Override
  public void start(Stage primaryStage) {
    final BorderPane root = new BorderPane();
    Button button = new Button("Click me to start...");
    root.setTop(button);
    final Service<Void> service = new Service<Void>() {
      @Override
      protected Task<Void> createTask() {
        return new Task<Void>() {
          @Override
          protected Void call() throws Exception {
            final int numThingsToDo = 50;
            for (int i = 0; i < numThingsToDo && !isCancelled(); i++) {
              Thread.sleep(100);
              updateProgress(i + 1, numThingsToDo);
            return null;
    // Disable button while service is running:
    button.disableProperty().bind(service.runningProperty());
    final Stage progressDialog = createProgressDialog(service, primaryStage);
    button.setOnAction(new EventHandler<ActionEvent>() {
      @Override
      public void handle(ActionEvent event) {
        progressDialog.show();
        service.reset();
        service.start();
    final Label status = new Label();
    status.textProperty().bind(Bindings.format("%s", service.stateProperty()));
    root.setBottom(status);
    Scene scene = new Scene(root, 400, 400);
    primaryStage.setScene(scene);
    primaryStage.show();
  private Stage createProgressDialog(final Service<Void> service, Stage owner) {
    final Stage stage = new Stage();
    stage.initModality(Modality.WINDOW_MODAL);
    stage.initOwner(owner);
    final BorderPane root = new BorderPane();
    final ProgressIndicator indicator = new ProgressIndicator();
    // have the indicator display the progress of the service:
    indicator.progressProperty().bind(service.progressProperty());
    // hide the stage when the service stops running:
    service.stateProperty().addListener(new ChangeListener<State>() {
      @Override
      public void changed(ObservableValue<? extends State> observable,
          State oldValue, State newValue) {
        if (newValue == State.CANCELLED || newValue == State.FAILED
            || newValue == State.SUCCEEDED) {
          stage.hide();
    // A cancel button:
    Button cancel = new Button("Cancel");
    cancel.setOnAction(new EventHandler<ActionEvent>() {
      @Override
      public void handle(ActionEvent event) {
        service.cancel();
    root.setCenter(indicator);
    root.setBottom(cancel);
    Scene scene = new Scene(root, 200, 200);
    stage.setScene(scene);
    return stage;
  public static void main(String[] args) {
    launch(args);
}

Similar Messages

  • How do I get rid of the Microsoft Setup Assistant loop? I migrated my software/documents from another laptop so don't have the disk to reinstall. Please help! Can't open any Microsoft Office software, like Word, and stuck in a loop?

    I migrated my software/documents from another laptop so don't have the disk to reinstall. Please help! Can't open any Microsoft Office software, like Word (for 2008), and stuck in a loop?
    Whenever I select Word Microsoft Setup Assistant appears, asks for feedback, then after selecting okay (both on saying yes or no to feedback) goes on to a registration page. When I click on this it says I've already registered so I just click okay, and then move on to a update page. After this, if I click on Word, the process repeats itself.
    As I said, I don't have the disk to reinstall, and can't find the Office Settings to delete as many pages have suggested I should try. Safe Boot restarting also hasn't worked... Really stuck and need Word very soon for work.
    If you can help, that would be great, and feel free to ask any questions about the situation as I'm not an expert here.
    Cheers,
    Jack

    First, export your contact from iCloud.com and save them on your computer in a safe spot some where (like you desktop).  Use this to help you do this: http://support.apple.com/kb/PH3606
    Next, on both of your devices, go to Settings > iCloud and turn on contacts and select Merge. Then turn off contacts and select 'Delete form my [device]' when prompted.
    Now go back to iCloud.com and select a contact (yes they will all be messed up again) and select Command+A on a Mac or Control+A on a PC to select all of the contacts.  Tap the delete key on your keyboard (or right click /control click a contact and select delete).
    You iPhone, iPad and iCloud.com should not be empty for contacts.
    Go back to Settings > iCloud on both devices and turn on contacts again (you should not see merge this time).
    Next, go back to iCloud.com and import your contacts (those exported .vcards).  You can either drag and drop them into the empty contacts list in your web browser, or you can use the gear icon to import.
    You cleaned up contacts should import correctly into iCloud.com and sync to both of your devices.
    Good luck.

  • Ok here goes.  I have so much music I don't want to store it all on my computer and would like to store on an external hard drive.  So if all my music is on the external hard drive, how will iTunes see it in order to play the music.  Thanks

    ok here goes.  I have so much music I don't want to store it all on my computer and would like to store on an external hard drive.  So if all my music is on the external hard drive, how will iTunes see it in order to play the music.  Thanks

    This article might help you moving/relocating your library :
    http://support.apple.com/kb/ht1449
    Cheers AF

  • I need an application that will turn off my iPhone on the home screen just by a one click since my power button has sank and is no longer working--anyone have ideas?? I don't like having to use assistive touch and hit three buttons to lock my screen

    I need an application that will turn off my iPhone on the home screen just by a one click since my power button has sank and is no longer working--anyone have ideas?? I don't like having to use assistive touch and hit three buttons to lock my screen

    No such app exisits or can exist.  Apple doesn't allow 3rd party apps to access core functions of the phone.  Time to get your phone replaced or repaired if assistive touch doesn't needs your needs.

  • Hello , I have befor IDVD but when I Delet all system I Buy nye I Movie , I Photo but i don`t have Idvd like befor where i can dowload ? Pleas help me

    Hello , I have befor IDVD but when I Delet all system I Buy nye I Movie , I Photo but i don`t have Idvd like befor where i can dowload ? Pleas help me

    sergiyMSI wrote:
    My Mac came with iLife08 , this is been install to  my Mac in the shop
    in the box your Mac delivered with were TWO grey DVDs... these are the 'reinstaller disk' every Mac is sold with.
    one contains the pre-installed software, make a 'custom install' to install ONLY iDVD ... -

  • Seriously, Stop the DUPLICATE Madness! Is there a fix for my duplicate songs on my iPad? Like really, I don't have time to drag and delete my songs. Does Apple really have a simple solution to this bug?

    Seriously, Stop the DUPLICATE Madness! Is there a fix for my duplicate songs on my iPad? Like really, I don't have time to drag and delete my songs. Does Apple really have a simple solution for this bug? It's been 5-months, I currently do not have quick access to a sync, I thought iMatch for Christmas would solve the problem but it appears that doesn't solve anything either....help please! If I listen to my kid's lula-bye song in duplicate for another night I'm going to seriously loose it on Little Boy Peep. Like really Apple do I need to call IN and pay for this problem?

    The possible problem appears to me that songs that were previously loaded onto the iPad device from Mac were duplicated when I started to sync with iCloud. An album will contain one song from the iPad that was originally loaded on sync with Mac and another that will appear either with a little iCloud icon next to the song greyed out or a DUPLICATE song.
    I had hoped iMatch would solve the issue magically, but that does not appear to be the case.

  • I have updated to iTunes 10 and now my unchecked songs are playing... I don't want this and can't figure out how to have it like it was before (not playing unchecked songs). Please help!

    I have updated to iTunes 10 and now my unchecked songs are playing... I don't want this and can't figure out how to have it like it was before (not playing unchecked songs). Please help! I leave the unchecked songs in there b/c there will come a point in time where I want to listen to these songs but right now I don't.

    yes, 10.3.1, iTunes already restarted, menu settings already like that and still it will play all unchecked songs (including the checked songs of course). Why even have check and unchecked if the program is going to play all of them anyway?!
    thanks for responding though...

  • I have iphone 4 . I don't know how that happened that  the normal color  on all icons changed ( for example, normally green color phone icon is now purple color ) and photo pictures turned negative ( ghost-like ). Your help will be appreciated .

    I have iphone 4 . I don't know how that happenned that the normal color on screen and all icons changed ( for example , normally green color phone icon became purple color ,) and photo pictures turned negative appearance ( ghost-like ) . Any idea how to fix this mishap ?  Your help will be appreciated.

    Hi kshieh
    You can try two possible steps:-
    1]Triple click the home button.  You should get an accessibility menu.deselect the negative/black and white option.
    2]Go to settings->General->accessibility->and deselect invert colours.
    That should fix it
    Rithwik

  • Does Apple have anything like Microsoft's OneNote (where I don't have to use a cloud server)?

    Does Apple have anything like Microsoft's OneNote (where I don't have to use a cloud server)?

    Rob, others,
    For CS6 (as for CS5 and CS5.5), registration with Adobe forms part of activation, so none of them can be run without Adobe having your registration number.
    So they must have it, and you must be able to get it, through your Adobe ID, or if that has changed through some other information such as name, email address, or something.
    You should be able to get help one of these places if needed,
    Serial number and activation support (non-CC, chat open between 5AM and 7PM PST/PDT on workdays)
    http://helpx.adobe.com/x-productkb/global/service1.html
    Adobe ID and registration support (non-CC, chat open between 5AM and 7PM PST/PDT on workdays)
    http://helpx.adobe.com/x-productkb/global/service-c1.html
    Adobe Support (phone),
    http://helpx.adobe.com/adobe-connect/adobe-connect-phone-numbers.html
    or I can alert a forum staff friend that may alert the right someone to deal with it.

  • Hi, Joann JustAnswer has asked me to answer your question -- "I have iPad 2 and I don't see the little box at top in safari to let me see the open pages I have. In iPad 1 it was next to the open book at the top

    Hi, Joann
    JustAnswer has asked me to answer your question -- "I have iPad 2 and I don't see the little box at top in safari with the number on it that I can tap to get to my open pages
    On iPad 1 it was next to the little open book

    Not with iOS 5 no. A number of other people have made the same comment about it, so you could try leaving feedback like some of them will have done, and maybe in a future iOS update we'll get the choice : http://www.apple.com/feedback/ipad.html

  • Why is my Ipod Touch 4th Gen saying i have headphones in when i don't?

    Last night I was using my Ipod and it worked fine without the headphones. When I woke up this morning it isn't working, when I turn the volume up it says i have headphones in but I don't. I have already tried the trick with taking out and putting in the headphones and i have reset it like 5 times now.

    You may have something stuck inside the headphone jack, blow inside a few times and see if that works. If not, restore the iPod. If that does not work, then that will indicate a hardware problem and you will need to get it fixed by Apple.

  • How do I get past the pass code on iPad running on Ios7.1 because j have forgotten it and I don not own a computer so it has to be with our a computer

    How do I get past the pass code on iPad running on Ios7.1 because j have forgotten it and I don not own a computer so it has to be with out
    a computer

    Use a friend's computer. Your iPad will be erased.
    How can I unlock my iPad if I forgot the passcode?
    http://www.everymac.com/systems/apple/ipad/ipad-troubleshooting-repair-faq/ipad- how-to-unlock-open-forgot-code-passcode-password-login.html
    iOS: Device disabled after entering wrong passcode
    http://support.apple.com/kb/ht1212
    How can I unlock my iPad if I forgot the passcode?
    http://tinyurl.com/7ndy8tb
    How to Reset a Forgotten Password for an iOS Device
    http://www.wikihow.com/Reset-a-Forgotten-Password-for-an-iOS-Device
    Using iPhone/iPad Recovery Mode
    http://ipod.about.com/od/iphonetroubleshooting/a/Iphone-Recovery-Mode.htm
    You may have to do this several times.
    Saw this solution on another post about an iPad in a school environment. Might work on your iPad so you won't lose everything.
    ~~~~~~~~~~~~~
    ‘iPad is disabled’ fix without resetting using iTunes
    Today I met my match with an iPad that had a passcode entered too many times, resulting in it displaying the message ‘iPad is disabled – Connect to iTunes’. This was a student iPad and since they use Notability for most of their work there was a chance that her files were not all backed up to the cloud. I really wanted to just re-activate the iPad instead of totally resetting it back to our default image.
    I reached out to my PLN on Twitter and had some help from a few people through retweets and a couple of clarification tweets. I love that so many are willing to help out so quickly. Through this I also learned that I look like Lt. Riker from Star Trek (thanks @FillineMachine).
    Through some trial and error (and a little sheer luck), I was able to reactivate the iPad without loosing any data. Note, this will only work on the computer it last synced with. Here’s how:
    1. Configurator is useless in reactivating a locked iPad. You will only be able to completely reformat the iPad using Configurator. If that’s ok with you, go for it – otherwise don’t waste your time trying to figure it out.
    2. Open iTunes with the iPad disconnected.
    3. Connect the iPad to the computer and wait for it to show up in the devices section in iTunes.
    4. Click on the iPad name when it appears and you will be given the option to restore a backup or setup as a new iPad (since it is locked).
    5. Click ‘Setup as new iPad’ and then click restore.
    6. The iPad will start backing up before it does the full restore and sync. CANCEL THE BACKUP IMMEDIATELY. You do this by clicking the small x in the status window in iTunes.
    7. When the backup cancels, it immediately starts syncing – cancel this as well using the same small x in the iTunes status window.
    8. The first stage in the restore process unlocks the iPad, you are basically just canceling out the restore process as soon as it reactivates the iPad.
    If done correctly, you will experience no data loss and the result will be a reactivated iPad. I have now tried this with about 5 iPads that were locked identically by students and each time it worked like a charm.
    ~~~~~~~~~~~~~
    Try it and good luck. You have nothing more to lose if it doesn't work for you.
     Cheers, Tom

  • Why is it like if i don't sync the data in my pad to the itunes of my system ,the data in my ipad is getting cleared when i copy any thing to my ipad.This is not comfortable rite?why is this so.?or there is any other way?

    Why is it like if i don't sync the data in my pad to the itunes of my system ,the data in my ipad is getting cleared when i copy any thing to my ipad.This is not comfortable rite?why is this so.?or there is any other way?

    i noticed this as a bug in iTunes. make sure the correct file is selected in the preferences menus. It does not have to be the default location directiory as Vazandrew stated. your iTunes music library can be anywhere you want it. i have mine on an external cuz i'm a dj and have over 80,000 songs.
    once you select/verify the location of your music library, simply drag the folder into the left panel in iTunes from a finder window. iTunes does not automatically add the items like it use to for some reason.

  • I have a Ipod touch that don't turn on and when connect to itunes, it's recognize

    I need Help!!!
    I have a Ipod touch that don't turn on and when connect to itunes, it's recognize

    I tryed but it isn't work, it like death, but when I connect to Itunes it is recognize like a Iphone, but without more information, just the name= Iphone and the other thinks are capacity software serial number N/A.
    And when i try to rest isn't Work
    (Thank for your help)

  • Software update says i have applications open when i don't

    Software updater tells me I have applications open when I don't.  Now I can't even shut down the installer. HELP!

    Didn't  the installer give you an opportunity to quit it when it gave you that message?
    What were you updating?
    You should be able to force quit the installer just like any other app but depending on what you were installing when it failed, and depending on where in the installation process it failed, you could leave your system in an inseminate state.  That may mean you mght not be able to reboot.

Maybe you are looking for

  • PI 7.11 Receiver SOAP (Axis) Adapter with MTOM (Attachments)

    Hello, Iu2019m trying to configure the Receiver SOAP (Axis) adapter for sending SOAP attachments via MTOM to a third-party webservice, but I'm not getting that PI transform the binary encode64 data in an payload element into a MTOM attachment (xop:in

  • Cant find music I just bought

    I bought some music last night on my Iphone and now it is not coming up on my Itunes on my computer. what can I do it get it to show up?

  • Java Connection Pooling issue with Oracle 10g Express Edition

    Hello I have a Java based web application that uses the Oracle 10g Express Edition database. I am using a connection pool to get connections to the database. I use the NetBeans IDE and run my web application on the bundled Tomcat server(5.5.7) that c

  • OIF - can I edit specific error messages back to user?

    I've had a request from end-user support to change a specfic error message generated by OC4J /shareid app. At present if a user tries to access a session that's been invalidated (logout, session timeout, etc.) they are presented with an error: Identi

  • IOS App Build

    Had a quick question, when I did my final build using my distribution profile and certificate, the app wouldn't install on my iPad using the Deployment option to install to connected device.  Is this expected behaviour?