Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>IMHO the best way to do this is to have your data (ie: turns) in a seperate class.</p> <p>Remember JavaFX is a MVC model. You could use a Model class to keep this information and reference this one. If you are passing a reference to your model class to another thread you would have to synchronize this one.</p> <p>This way you would keep things seperate. Your Controller would only be controlling WHAT the scenes are doing. Your model would be storing the information.</p> <p><a href="https://stackoverflow.com/a/12167932/686036">This answer</a> gives a very good starting point as to how to implement this.</p> <p>For example I have a task (file watcher) and I call it as indicated below. Here is a quick snapshot of my controller : </p> <pre><code>public class myController { private Context context; private Executor executor; ... myBtn.setOnAction(new EventHandler&lt;ActionEvent&gt;() { public void handle(ActionEvent event) { task = new ResultFileWatcher(context); //context is my singleton model class executor.execute(task); } } ... } </code></pre> <p>and my class that extends class looks a bit like this. This here is my <code>Task</code> (note this extends the class <code>Task</code>) that will be running in a different <code>Thread</code>.</p> <pre><code>public class ResultFileWatcher extends Task&lt;Object&gt; { private Context context; public ResultFileWatcher(Context context) { this.context = context; } ... @Override protected Object call() throws Exception { //... } } </code></pre> <p>Hope this helps!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload