Why are UI nodes manipulate operations blocked by the code after them?

public void start(Stage stage) throws Exception {
     BorderPane root = new BorderPane();
     final Pane pane = new Pane();
     Button button = new Button("Click Me");
     button.setOnAction(new EventHandler<ActionEvent>() {               
          @Override
          public void handle(ActionEvent arg0) {
               Rectangle rectangle = new Rectangle(300, 100);
               rectangle.setFill(new Color(Math.random(), Math.random(), Math.random(), 1));
               pane.getChildren().clear();
               pane.getChildren().add(rectangle);
               try {
                    Thread.sleep(3000);
                    } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
     root.setCenter(pane);
     root.setBottom(button);
     Scene scene = new Scene(root, 500, 400);
     stage.setScene(scene);
     stage.show();          
The rectangle will be added to the pane after the thread wake up. I am new to JavaFX, who can help me? Thanks.
Edited by: 981471 on Jan 12, 2013 5:29 AM
Edited by: 981471 on Jan 12, 2013 5:30 AM
Edited by: 981471 on Jan 12, 2013 5:30 AM
Edited by: 981471 on Jan 12, 2013 5:31 AM

This seems normal to mee, because you've added Thread.sleep(3000);
This will make your current Tread inactive for 3sec. (so no UI rendering)
Look at this tutorial for Concurrency: http://docs.oracle.com/javafx/2/threads/jfxpub-threads.htm
Edited by: 981077 on 15-jan-2013 7:16

Similar Messages

  • Why are java windows showing transparency when using the Aero Peak Themes in windows 7 home premium

    I'm using Windows 7 home premium version. When I choose an "Aero Theme" selected from Control Panel/All Control Panel Items/Personalization, Java windows become transparent. I.E. the java content showing with the widows desktop image showing also. When choosing a regular theme, the java window is normal. The problem does not occur when running Firefox in "safe mode".

    I'm using Windows 7 home premium version. When I choose an "Aero Theme" selected from Control Panel/All Control Panel Items/Personalization, Java windows become transparent. I.E. the java content showing with the widows desktop image showing also. When choosing a regular theme, the java window is normal. The problem does not occur when running Firefox in "safe mode".

  • Why are animated gifs not displaying animations in the preview?

    Why are animated gifs not displaying animations in the preview?
    My coworkers and I are not seeing a animation in the preview pane in Adobe Bridge CS6 even when clicking the play button in the preview window. However, we do see a graphic of the first frame and one person sees 1 frame when clicking play and one other frame and then the animation stops, however, that is not the complete animation.
    I'm using Windows 7 32 bit
    My coworkers are using a mac.
    One coworker has apple OS Mountain Lion with a Intel Quad-Core Xeon – 64 bit system.
    Is this fixable or in the works as a patch? Otherwise we have to open these docs in a browser in order to view them properly.

    I've just come to the realization that some animated gifs do play fine and others do not. A coworker of mine suggests that if it's an animation made via Adobe Photoshop, it'll work in bridge but will not if it's made using something else.

  • Why are there so many more choices on the USA iTunes Store? Surely having an iTunes account should let you access all itunes availability the world over? Also how do you request films/tv series to the UK itunes?

    Why are there so many more choices on the USA iTunes Store? Surely having an iTunes account should let you access all itunes availability the world over?
    Also how do you request films/tv series to the UK itunes? There's tv series I'd like but they're incomplete like The Batman &amp; Xena Warrior Princess. And films theta aren't available for download but you can purchase in a store like HMV?  Apple isn't doing itself any favours by secluding countries by their store. They'd make billions if you could just select the iTunes Store you want to search &amp; purchase from just by signing in! If anything what they're doing is putting themselves into a corner, other companies like Samsung &amp; HTC are already on too of them for innovation &amp; ease of use. The people they're attracting are predominantly existing Apple users not new customers. What do you guys think?

    It's not Apple's choice, they can only sell a particular item where the content provider/rights-holder has granted them a license to sell them. Content is licensed by the rights-holders to Apple on a country-by-country basis, each country therefore has to have its own store, and you have to be in a country to use its store - they want control over where their content is available.
    You can try requesting that an item be added to the UK store via this page, but unless the rights-holder agrees to then Apple won't be able to sell it here : http://www.apple.com/feedback/itunes.html

  • Why Are Some Of My Downloads Landing In The Trash?

    Why are some of my downloads landing in the trashcan? I just went to empty my trash can and when I opened it up I found about 5 files that I downloaded just last night. Why would my personal and important files have found thier way into my trash can?
    Blessings,
    Damon

    sometimes, depending on how the file was compressed, the .zip or .sit files will go into the trash once uncompressed.
    are the uncompressed files still in your download location? (desktop, download folder, etc.)

  • Why are lyrics not viewable in itunes in the same way as on the ipod?

    Why are lyrics not viewable in itunes in the same way as on the ipod? In itunes all you get is "Get Info" then "Lyrics" and that screen then locks itunes until you close it. Inflexible, annoying and surely unnecessary?

    All songs need Album, Artist and title.
    Also, look under Artist -> Compilations.

  • Why are websites in firefox loading in an index mode after upgrading to mountain lion?

    why are websites in firefox loading in an index mode after upgrading to mountain lion?

    Hi Canes,
    Sorry - not sure what you mean?
    GB

  • Why are my Whatsapp photos not showing in the Camera Roll? I have checked all the settings and everything seems ok.

    Why are my Whatsapp photos not showing in the Camera Roll? I have checked all the settings and everything seems ok.

    Have you enabled "Save incoming Media"
    in your whastapp\Setting\Chat setting\Save Incoming Media?

  • Why are my pinned top sites disappearing from the top sites page in Mavericks, after they have been pinned? Very appreciative of any help. This is making me crazy.

    Why are my pinned top sites disappearing from the top sites page in Mavericks, after being pinned? Any help would be greatly appreciated.

    Why are my pinned top sites disappearing from the top sites page in Mavericks, after being pinned? Any help would be greatly appreciated.

  • HT204411 Why are some films available for download in the USA and not the UK or vice versa?

    Why are some films available for download in the USA and not the UK or vice versa? For example the film 'Back to the Secret Garden' is available for download in the US and not the UK.

    MikeAlan192 wrote:
    Why are some films available for download in the USA and not the UK or vice versa? ...
    Availability is determined/controlled by the Copyright owner... not Apple.

  • I have these black boxes around all the images i add. why are they there and how do i get rid of them?

    i have black boxes around all the images i bring into pages. why are they there and how can i get rid of them?

    Pages rememebers the last setting you used on images.
    So if you had a border on the last image the next one you bring in will have one too.
    To change that select:
    Inspector > Graphic > Stroke > None
    Spend a little time exploring the menus and particularly the Toolbar and Inspectors whcih are in reasonably logical progression from big things down to smaller details and clearly labeled.
    It is also possible that you have show Layout on which outlines objects on th screen so you can see what's what. To change that:
    Menu > View > Hide Layout
    Peter

  • "Object Required" error when using the script block from the code behind

    I try to use the following script block on the code behind page
    <script defer='true' id='NavID' type='text/javascript'>Nav();</script>
    and the function Nav() is on the .aspx page. It gives me the "Object Required" error message. BUT if I add an alert("hello!!!") line inside of the Nav() function, it works fine after the user closes the alert box. Has anyone experienced a similar problem? Please help. Thanks.

    There is no way to troubleshoot this by looking at a picture of the diagram. LabVIEW 6 is almost prehistory and many things have changed, especially the file IO all looks different so it is impossible to tell what you are doing.
    Error 7 is file not found, so most likely your string operations are not correct. What are the full strings? What is the final file name (maybe you are missing a "\" or maybe you are on a different OS type). Put an indicator at the path wire to see what's happening!
    Is this a datalog file?
    (Overall, the code is a bit suspect. Nobody needs a seven frame flat sequence. ) Why do a control and an indicator have the same label?)
    LabVIEW Champion . Do more with less code and in less time .

  • What are BI reports and ABAP reports and the difference between them ?

    What are BI reports and ABAP reports and the difference between them? please explain me in detail and let me know if you have some documentation about it.
    Thank you in advance!
    Steve Jobs

    Do we have to write custom code for the ABAP reports? Do you have any documentation about it?
    Thank you.
    Steve Jobs

  • Why are there virtually no mobile apps for the Android operating system?

    I am trying to find mobile apps for my android tablet. Why are there virtually no mobile apps for this system?

    Adobe's attitude is not only incredibly insulting and ignorant, it is also short-sighted, particularly considering the top android handsets would actually allow their apps to be more flexible and powerful as they have more RAM at their disposal and the very popular Galaxy Note series would be a perfect device with its integral stylus. This is not acceptable and makes me reconsider staying with my CC subscription. I guess it is time to start looking for adobe alternatives or at the very least demand a discount in our subscription as we are unable to use a large chunk of the subscription portfolio.

  • Why are all jar files not compressed in the JRE installer?

    I used 7zip to unpack jre-6u12-windows-i586-p.exe (Oracle JRE Installer). On unpacking, I got a core.zip, a zipper.exe and a few other files.
    Again on exploding core.zip I found a few things. core.zip contains all the jar files just like it would be after installation except for 7 jar files.
    charsets.jar
    deploy.jar
    javaws.jar
    jsse.jar
    localedata.jar
    plugin.jar
    rt.jar
    Instead of these jar files there exists the corresponding packfiles
    charsets.pack
    deploy.pack
    javaws.pack
    jsse.pack
    localedata.pack
    plugin.pack
    rt.pack
    I think these are files created by pack200.exe & unpack200.exe is run on them after installation to create the corresponding jar files.
    So now I have a few questions
    Why are only these 7 files run through pack200.exe. I assume its because they are bigger than other files. But it wouldn't take that much effort to pack all jar files & unpack them after installation.
    The .pack extension suggests that these are packed but not gzipped. Again why would Oracle not do a gzip also? for eg with rt.jar packing reduces size from 45 MB to 12 MB, while adding gzip also reduces it to 6 MB.
    Edited by: 966944 on Oct 22, 2012 8:19 AM

    Whatever the truth of all this may be, you won't find it here. This is a user to user forum, not Oracle support or a channel to the developers. All you will get here at best is valid post hoc reasoning: at worst, guesswork. And if you're trying to bring this issue to Oracle's attention, again this isn't the place to do it. Locking the thread.

Maybe you are looking for