Since version 2.0 of JavaFX, I was very keen about this technology and was looking forward to use it in some project. Hello world is fine, but you need some real application, used by real people. First opportunity came with AgroSense project, where we developed Gantt chart component for planning (similar to Google Calendar or Outlook). As far as I know, this component was never used and now there are plenty of alternative solutions, but it gave me some insight to the library (is it library, or platform?) and its features. Few months ago another opportunity came in my company, where we decided to rewrite legacy self-service cafeteria terminal. The application is quite simple - user signs with his/hers contactless smart card and adds grocery to the shopping cart using barcode scanner or touch screen. This application is only for internal use in our company, so we decided to experiment a little and use JavaFX to the frontend of the application. We use quite ordinary ...
I’m pretty sure, you know java.lang.Thread class and it’s API. Today I want to spend some time with sleep method. void sleep (long millis) is pretty straight – just remember not to set negative value and be ready for InterruptedException , that’s it. But what if you need better precision? Great, there is another sleep method, this time with two arguments – millis and nanos. The Javadoc is clear: Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds, subject to the precision and accuracy of system timers and schedulers. See? You can set some amount of nanoseconds to the Thread to sleep, but the precision is dictated by system timers and schedulers. Okay computers are fast these days, so the precision wouldn’t be so bad. You start to use it, but the results are far from what you expected. Double check your code, everything looks good. Okay it is time to see the source code. WTF. WTF? WTF! ...