Friday, December 12, 2014

Friday Fun Component XXII

And another one...
Last weekend I took a closer look to the new Yotaphone 2 which in principle is just another Android mobile phone BUT it has a second screen on the backside. And this is not a standard screen, it's an e-paper display.
I really like the simplicity of the widgets that they use on the e-paper display and especially the clock looked good to me...
So I created a version in JavaFX and here it is...

As you can see this is a really simple clock but that's exactly what I like about it... :)
It has not many features, so one can update the time by calling updateTime() which will show the current time or you can update it with your own time with updateTime(LocalDateTime). In addition you can define the background and foreground color with setBackgroundColor(Color) and setForegroundColor(Color). And there is a method to invert the colors called setInvert(boolean) and that's it.
Like I said it has not many features but hey...it's just a simple clock :)

If you like it you can fork it on Bitbucket as always...

That's it for today...keep coding...

5 comments:

  1. Sleek!

    Just curious: Why didn't you use JavaFX Timeline for the updates?

    ReplyDelete
    Replies
    1. Because I would like to use the clock on an e-paper display I've tried different approaches to reduce the cpu utilization and ended up using a scheduled future to realize it. You can also use a timeline.
      Cheers
      Gerrit

      Delete
  2. Thanks. The simplicity makes it easy to see how you did it. Do you code the builders manually or is there a code generator for it?

    ReplyDelete
    Replies
    1. Everything is done manually...no generators involved :)

      Delete
  3. I like the style and I'd like to create my own builders. However I've noticed that "builders" are deprecated in Java now. I also read this: http://mail.openjdk.java.net/pipermail/openjfx-dev/2013-March/006725.html So I'm confused. Is there a proper way / pattern to create builders?

    ReplyDelete