• Home
  • Events
  • About
  • Friday Fun XLVII – Back to life…

    Back to life…

    after all that Serverside stuff in Singapore during the last months I’m finally back home and even more important back into JavaFX 🙂

    So this week I have created a little JavaFX control which I saw on my iPhone and Mac. If you know iTunes you know that little progress/timer control which Apple uses to visualize the download of a song and also the playtime of that song.

    It is not a really fancy control but maybe that is the reason why I like it, it is simple and does not need any explanation…very nice.

    So here is a little screenshot of the control I’m talking about…


    Yes it is very small so I did what I always do as a first step…I create a drawing which looks like follows…

    So this control has more or less three states

    • STOPPED
    • WAITING
    • RUNNING

    These states have different visualizations as you can see in the image above.

    The STOPPED state is visualized with a ring and a play icon which indicates to click it to start a process.

    In the waiting state the color is different and the outer ring has a gap and is rotating. In addition the icon changed from a play icon to a stop icon which indicates that you can stop the waiting by pressing the control.

    In the running state the color changed back to the original one and the progress is visualized by an additional progress bar.

    In my implementation the control will fire events in different situations, so you will find a TimerEvent class which has a Type. The types are as follows…

    • STARTED (fired when the timer was started)
    • STOPPED (fired when the timer was stopped)
    • CONTINUED (fired when the timer was stopped and not finished yet)
    • FINISHED (fired when the timer finished)
    • RESET (fired when the reset() method was called)
    • WAITING (fired when the timer was set to waiting)

    You can attach a TimerEventListener to the control and your program can react on the different events that the control will fire.

    The control has the following properties which you can use…

    • backgroundColor
    • color
    • waitingColor
    • playButtonVisible
    • duration

    Most of the properties are self explaining so I will only shortly explain the playButtonVisible property.

    Because this control might also come in handy when visualizing a download etc. it is not always needed to show the play button but only the stop button when it is running. For this reason the play button can be switched off.

    The duration defines the time the control will running until it is finished.

    Here is a little video of the control in action…

    Attention:
    I have no really use case for this control and just created it because I like it and would like to see how much does it take to implement it in JavaFX

    Well that’s it for today, so as always you will find the code over at github…

    Enjoy the upcoming weekend and…keep coding…

    Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
    • email
    • Print
    • Twitter
    • LinkedIn
    • XING
    • Facebook
    • Google Bookmarks

    Leave a Comment

    Time limit is exhausted. Please reload the CAPTCHA.

    css.php