Can't update GridPane from Button Action

I'm making a simple gui for Conway's Game of Life with a grid (GridPane) and a simple toolbar with Start/Stop buttons. My start button action looks like this:
startButton.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent actionEvent) {
            grid.change();
    });So when i click it the grid updates ones as i expect. But i when i add something like a Service/Platform.runLater/Runnable inside it evaluates generations, grid model, but refuses to update the grid view. My Service code looks like this:
private Service task = new Service(){
    @Override
    protected Task createTask() {
        System.out.println("Task created");
        return new Task<Void>() {
            @Override
            protected Void call() throws Exception {
                for (int i = 0; i < 3; i++) {
                    System.out.println("calling");
                    Platform.runLater(new Runnable(){
                        @Override
                        public void run() {
                            System.out.println("running");
                           grid.changeGeneration();
                            try {
                                Thread.sleep(1500L);
                            } catch (InterruptedException e) {
                                e.printStackTrace(); 
                return null;
};It prints Task created calling calling calling running running running to the console, but doesn't update the GridPane after each running, only after everything is done it updates it (in this case after the third "running"). Where am i making a mistake and how to fix this. I don't want to use Swing =)
Same question on [http://stackoverflow.com/questions/13820734/cant-update-gridpane]
Edited by: Riddle on 11.12.2012 7:21

public void changeGeneration() {
        Cell[][] newGen = new Cell[rows][cols];
        Cell cell;
        for (int i = 0; i < newGen.length; i++) {
            for (int j = 0; j < newGen.length; j++) {
cell = new Cell(destiny(cells, i, j));
newGen[i][j] = cell;
add(cell, i, j);
curGen = newGen;
My grid class is a subclass of GridPane
So when i click button it's working, but not from other Runnable
Edited by: Riddle on 11.12.2012 9:11                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Can I update iPhoto from version 8.1.2 to 9 or higher versionfor free?

    Can I update iPhoto from version 8.1.2 to 9 or higher versionfor free?

    Is your profile signature "Mac OS X (10.6.8)" still current? With that MacOS X version you can upgrade to iPhoto 9.2.x. Only, the iPhoto version 9.5.1 currently sold at the AppStore requires MacOS X 10.9.x. If you you are not running Mavericks, you could try to buy a boxed retail version of iLife '11. That will have a compatible early iPhoto 9.x version.

  • How can I update itunes from just my iphone

    I recently purchased a new windows pc.  During the update process  some tracks were unreadable and I lost all play lists.  How can I update itunes from just my iphone to update itunes?

    iDevices are not backup devices.
    Copy the ENTIRE iTunes folder from the old computer or backup of the old computer to the new computer.

  • How can I update apps from iCloud to my iPad

    How do I update apps from MacBook Pro OSX10.92 to my iPad?

    Hey forgetyou,
    Thanks for using Apple Support Communities.
    If you can’t update wirelessly, or if you want to update with iTunes, follow this article.
    Update your iPhone, iPad, or iPod touch
    http://support.apple.com/kb/HT4623?viewlocale=en_US
    Have a nice day,
    Mario

  • Can access c++ library from flash action script by using SWC lib?

    We want to develope a Flash application based on Windows CE 6.0 R3. The application aims to communicate with middleware libraries written in C/C++. Is it possible to create SWC file using the c++ library file so that we can load this as a component in fla project for accessing the library functions from flash action script 3.0? OR Is there any simple way to access c++ library from action script?
    Thanks,
    Saumini

    I don't think Alchemy will help you.  The reason is Alchemy does not give socket capabilities beyond what Flash provides.

  • Can't Update Apps from the Appstore

    I have all the latest OS updates for my macbook pro and it seems like I can't update my apps that I have downloaded from the appstore.  I have logged into the appstore and iTunes and also have made sure the information in the account are correct and up to date.  When I open the appstore I click on updates and it says, "All Apps Are Up to Date" but when I click on "Purchased," it clearly shows that there are updates available.  When I click on update it says that I need to be signed in in-order to update the apps.  I AM signed into the appstore and iTunes.  What is going on here?  I tried emailing support for Apple and they couldn't even help me.  I know there are people having the same issues.  Can someone point me to the right direction or have any advices to fix this issue?  Its very annoying unistalling an app and to reinstall just to update it.  Thank you in advance.
    Edward_k

    I had just posted a thread regarding a similar issue, except it's attempting to "load" all of my apps again. This includes loading old apps that were previously deleted off my iphone. It's annoying. I can't even access these apps to delete them. This renders my phone useless...

  • Can I update iWeb from a different Mac

    My MacBookPro went down last week. I need to update our website, can I do it from the MacBook?
    If so, how? I use iWeb & I think I publish to Moible Me, but I am really not sure at this point?

    What caused the old Mac to crash?  If it wasn't a disk crash but a mother board or other component crash you should be able to remove the hard drive out of it, connect it to the new Mac and save your files.
    OT

  • Charged my email(user name) and now we can't update apps from the original email is there a way to link?

    apps from old email user name will not update. Anyone know how to link this

    If you updated your existing account then try logging out of it on the iPad by tapping on the id in Settings > Store (Settings > iTunes & App Stores on iOS 6) and then log back in and see if that 'refreshes' the account on the iPad and whether you can then update the older apps. If you created a new account then any content that you purchased/downloaded via the old account will remain tied to that old account, and only that old account can download updates to its apps.

  • Can I update only from my iMac and have data flow to iPhone and MacBook, not the other direction?

    New to iCloud and Lion.  Can I update via iCloud only from my iMac and have data flow to my  iPhone and my MacBook, not the other direction?

    No. Syncing means bringing both ends to be the same.

  • Can't update apps from old apple id

    I updated my apple id e-mail and now I can't update an app associated with the old e-mail.  The old password won't work and when I have it send an e-mail to reset my password I never get the e-mail.

    Did you update the email used in the old Apple ID or did you create a new Apple ID? If you made a new Apple ID, that was not a good idea. Content is for ever tied to the ID that bought it. Only that I can be used to redownload content and to update the content. Apple does not tranfer content from one Apple ID to another nor does Apple merge Apple IDs. You will need to continue to use the old ID to update the content or abandon it all as is.

  • I can not update ipad2 from iOS4 to 5 there is no "software " in the settings

    How to update ipad2 from iOS4 to 5 and eventually to 7.there is no 'software' in 'setting'

    You need to connect it to your computer and in iTunes update it.

  • Can't update apps from the iTunes App Store

    I have a ipod touch, in my japanese account i have a credit balance in yen in my Japanese account. but when i go to download the apps it indicated i'm logging in to the US store so i can't update.so i had tried to change my region, but it not allowed by stating that i can't change account without spending my balance. how to resolve this?

    If this does not help
    How to manage unused iTunes Gift Card and Gift Certificate balances
    Contact iTunes by
    Contact iTunes

  • Can you update itunes from what is on your ipod touch if they wont sync up?

    I have been trying for months to get my ipod and my itunes on the same page.  I have things on my pod that my itunes account say cant be found and things on my itunes Ive downloaded that wont transfer to my pod.  The answers I have gotten are to update itunes using an old back up which will mean Ill lose a good bit of what I have on itunes.  Is there not a way to update itunes from the ipod iteself?  Or am I being stupid here?

    Recovering your iTunes library from your iPod or iOS device: Apple Support Communities

  • Can't update N85 from 11.047 to 20.175

    Hi,
    For about a week ago, my phone (a Nokia N85 (RM-333)) told me that there were an update available for my phone. I said Yes to downloading it and installing it. So it downloaded about 5.6mb over my 3G connection and afterwards told me that the phone would restart. 
    For about 2 seconds, it said "Updating...", but then it just restarted the phone again.
    When the phone was started up, it told me that the phone wasn't updated because the package didn't match the phone.
    So now I'm trying to update the phone with Nokia Software Updater (v.1.6.13en-us), and it works fine until it starts updating the phone. After the update is downloaded (about 136mb) and it starts "Preparing installation" I get a "Update startup failed" message and a button saying "Try again". If I press the button, it starts over, and gives me the same error in the end.
    So now I'm a bit lost.
    I've tried to do a total phone reset *#7780# and *#7370#, but I still get the same error message. And my phone is still telling me that there is a new update available for download. The phone firmware is still 11.047 from 19-11-2008.
    What do I do now?

    When you say that everything works fine, do you mean the phone it self or that you are able to update the phone?
    Well, the newest version of the firmware is 31.002 (released a few days ago), and from 11.047 are there a some updates.
    The changelog looks like this:
    20.175:
    This software release comes with a number of improvements including e-mail and VOIP plug-ins, time zone updates, power save mode enhancement and IHF speaker tuning.
    30.019:
    This software release comes with improvements in USB charging and new features that help you stay in touch with your friends. Contacts include Ovi features that allow you to locate your friends and receive updates on what they are doing. You can also chat with your friends and share your favorite places with them.
    30.101:
    This software release includes improvements in copying contacts from your SIM card. 
    There are no details available yet for the the newest 31.002. But I guess most of it is bug/stability fixes.

  • Can i update itunes from one computer to the other with a thumb drive

    i have a computer that has no internet access but a laptop that does. is there a way i can update it with a file on a thumb drive?

    Hello Boyesreef,
    It sounds like you are wanting to update another iTunes library with files you have on a flash drive. You should be able to import them with this info:
    To add files to your iTunes library, you can use these options:
    Drag files from the Finder to the appropriate icon on the left side of the iTunes window.
    Choose File > Add to Library (on Windows, choose Add File to Library or Add Folder to Library) and select the song or folder that you want to add.
    From: iTunes: About the Add to Library, Import, and Convert functions
              http://support.apple.com/kb/ht1347
    If your end goal is that you would like both libraries to match on both computers, you can use the following article to copy the more complete library to the other computer all in one go:
    iTunes: How to move your music to a new computer
    http://support.apple.com/kb/ht4527
    Thank you for using Apple Support Communities.
    All the very best,
    Sterling

Maybe you are looking for