My life as an ScalaFx newbie!

Learning Scala coming from Delphi (object Pascal) and windows is an exercise in frustration. The fact that I haven’t done much programming since 2002 doesn’t help.

Why on earth do I keep learning Scala? Because its nice! Frustrating but nice! It is cross platform and has a nice syntax. It makes god looking code.

There is not a whole lot of newbie tutorials and examples out there when it comes to Scala itself. For ScalaFx there is even less…

After stumbling around in Scala and learning the very basic I decided to build an application that fetches temperature values from an Raspberry Pi at home and displays them.  Since Scala runs on Javas JRE , I started out with swing, then i turned to ScalaFx since it is more modern and has a lot of possibilities. Now it’s up and running. There is still a few snags to fix. But it’s there and it does what I intended.

The first hurdle was to decode the json output from the api on my webserver. As usual I didn’t have a clue, but stackoverflow once again came to my rescue. Here is the Q/A on

I created a simple gui in ScalaFx and got stuck really fast. It makes no sense getting the temps from the Raspberry more often than once every minute. Easy peasy! An infinite loop whith a wait method should do the trick…. But creating an infinite loop was not the answer. In Delphi I would have dropped a Ttimer object on my window and problem would have been solved.
It took me some hours of googling and reeding before I found a timer function that solved the problem. Everything works as intended except for one annoying and important thing. It will not close! The gui shuts down alright but the timer function does not. If any one know how to handle an exit event in ScalaFx please help me out!!!! I can’t find anything in the ScalaFx documentation, stackowerflow or google.

I guess I figure it out after banging my head against it for a couple of weeks…