GeeCON Prague 2014*
The moose likes JavaFX and the fly likes JavaFX and a Timeline ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JavaFX
Bookmark "JavaFX and a Timeline ?" Watch "JavaFX and a Timeline ?" New topic
Author

JavaFX and a Timeline ?

Ingi Erlings
Greenhorn

Joined: Nov 21, 2013
Posts: 6
Hi!

I have an idea for an application for my alotment and I wonder if JavaFX could be the "silver bullet" here.
I would like to create a simple canvas that emulates my alotment with my vegetables + sunflowers.
The timeline would for instance strech from early april to end of september.
The application would have a canvas showing the alotment : 10 x 13 meters.
I am able to plot a number of icons on the canvas: such as all the sunflowers.
The sunflower has 4 stages which describes the sunflowe lifecycle under good circumstances :
small-medium-max-dead and each stages has an Icon ( small yellow circle, medium yellow circle, large yellow circle and finally a brown medium circle ).
So if a plant 30 sunflowers on different dates I can 'play' the simulation and see hos they grow and die.

Is this possible ?

regards, i
Hendrik Ebbers
author
Ranch Hand

Joined: Jun 24, 2014
Posts: 32
    
    6
Sure!
If you are familiar with Java2D or HTML5 Canvas you could use the JavaFX Canvas Control. In this control you can paint whatever you want on a graphics canvas. Here is a quick overview: http://docs.oracle.com/javase/8/javafx/graphics-tutorial/canvas.htm#JFXGR214
My book contains an example, too.
But the better approach is to use the JavaFX scene graph. The scene graph can contain, layout, manage and render all your components. By doing so you can add event listeners, etc. on all the components. How the scene graph is working and how you can define own layouts, etc. is part of my book


[Mastering JavaFX 8 Controls]
Ingi Erlings
Greenhorn

Joined: Nov 21, 2013
Posts: 6
Hi!

Thanks Hendrik for your reply and the oracle-link.
Must take a look at this book, would love to learn this.

regards, Ingo
 
GeeCON Prague 2014
 
subject: JavaFX and a Timeline ?