javafx.concurrent.Task? Docs? Examples? Support recall GUI?

I want to do something simple:

Thread of GUI-> blow of background task that runs in the background thread.
Background full-> reminder of triggers in the GUI thread

The new beta, b36, a javafx.concurrent.Task, which should support this. I can't find any documentation or the sample code on it, and I cannot infer from the API signature how to achieve this.

I posted this same question on the article of Richard Blair about this, but no one answered and article itself has excerpts of stale code and does not also address the callback number.

With the help of Richard previous documentation and NetBeans I could do a simple service + the task of loading a file in the background:

    private void openFileAsync(final File file) {
        final PlotRepLoaderService repLoaderService = new PlotRepLoaderService(file);
        repLoaderService.stateProperty().addListener(new ChangeListener() {

            /**
             * {@inheritDoc}
             */
            @Override
            public void changed(ObservableValue observable, State oldValue, State newValue) {
                if (newValue == State.SUCCEEDED) {
                    // Setup display.
                    Rep plotRep = repLoaderService.getValue();
                    PlotRepPane plotRepPane = new PlotRepPane(plotRep);
                    root.setCenter(plotRepPane);
                }
            }
        });
        repLoaderService.start();
    }
/**
 * Service which loads plot.rep file asynchronously.
 * @author Fabrice Bouyé ([email protected])
 */
public class PlotRepLoaderService extends Service {

    private File file;

    public PlotRepLoaderService(File file) {
        this.file = file;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected Task createTask() {
        return new Task() {

            /**
             * {@inheritDoc}
             */
            @Override
            protected Rep call() throws Exception {
                System.out.printf("Reading file \"%s\"", file.getAbsolutePath()).println();
                Rep plotRep = RepReader.read(file);
                return plotRep;
            }

            /**
             * {@inheritDoc}
             */
            @Override
            protected void done() {
                System.out.println("done()");

            }
        };
    }
}

Initially, I tried to listen to change in the workDoneProperty, but discovered that he is never called, so I guess that miss me about the workings in my work (I'll find out when the documents & samples are displayed) or maybe it's a bug:

        repLoaderService.workDoneProperty().addListener(new ChangeListener() {
            /**
             * {@inheritDoc}
             */
            @Override
            public void changed(ObservableValue observable, Number oldValue, Number newValue) {
                System.out.printf("workDone %f -> %f", oldValue, newValue);
            }
        });

Tags: Java

Similar Questions

  • CFCLIENT: Doc examples don't work; Can't get anything to work?

    Then I realize that the new mobile features CF11 was received with some very mixed reviews, but I wanted to try to see if I could use for some really simple device detection, but I can't get anything to actually work.

    For example, I'm looking at the doc for cfclientsettings, specifically in the first example on the page under the heading "Detection devices. Here is the code for reference (I formatted it a bit to make sure it's easy to read here):

    <cfClientSettings detectDevice=true />

    <cfclient>

    <cffunction access="public" name="showCanvasSupport" returntype="void">

    <cfsetevalStr = "document.getElementById('canvas').innerHTML='" & cfclient.canvas & "'">

    </cffunction>

    </cfclient>

    Canvas support -<b id="canvas"></b><br>

    <button onclick="invokeCFClientFunction('showCanvasSupport',null)">Show canvas support< / button >

    Create a new .cfm page and adding this code produce the text and a button on the page, but clicking on the button launches a JS error in Chrome: "Eception the signature of the function is invokeCFClientFunction (nomfonction [, arg1, arg2, arg3,...], successCallback, failureCallback).» The functionName, the successCallback and the failureCallback are mandatory. If you don't have a successCallback or failureCallback, null can be passed as value. »

    OK, not very well.  So I checked a few docs more and decided to add another argument null to invokeCFClientFunction() call to correct the lack of recall.  This fixes at least the JS error, but now nothing happens when you click the button.

    So after a few more bother, I arrived at the following code, which does not always work, but that seems closer:

    <cfClientSettings detectDevice=true />

    <cfclient>

    <cffunction access="public" name="showCanvasSupport" returntype="void">

    < cfscript >

    document.getElementById('canvas').innerHTML=cfclient.canvas;

    < / cfscript >

    </cffunction>

    </cfclient>

    Canvas support -<b id="canvas"></b><br>

    <button onclick="invokeCFClientFunction('showCanvasSupport',null,null)">Show canvas support< / button >

    So, copy the following code, when you click the button, sets the innerHTML of the element canvas to "undefined". Awesome.

    Honestly, I've tried all the examples that I can find to use cfclient and NONE of them work. Is there some secret I'm missing? I have a sneaking suspicion that if I don't creates a 'Mobile project' in the CFBuilder which does not have anything like that? If yes it is stupid and that they state that in the docs really.

    What I'm trying to do, in the end, is just to use cfclient for a simple detection of devices and to enter the width of the browser/device to do some basic detection style query media love in "Using media queries" section of the cfclientsettings doc.  I want to just retrieve the width and then define a variable session based on it.

    I use a developer version fully patched for CF11 on my machine Win7 with IIS configuration. Any help is welcome.

    Post edited by: Andrew Regis Fixed some spelling/grammar mistakes!

    After hitting my head on my keyboard for a while more, I got the job of scope cfclient.

    I finally found this page in the docs: detect devices

    At first glance, this page seems almost identical to the page of doc cfclientsettings , even having the same code examples.

    However, where the cfclientsettings doc uses the scope as this:

    cfclient.canvas
    

    Detect devices doc page, he writes like this:

    cfclient.properties.canvas
    

    Boom. Of course, that's all it took. What a waste of time. All the cfclient scope variables of work very well if you add '.properties' in there.

    I still don't know if the doc cfclientsettings is simply false, or if it is referencing in a different context. I'll definitely add a comment to him on this point.

    (In addition, the JavaScript code still does not for this example on both versions of the doc, so there is that.)

    Hope this helps someone who wants to make simple customer ColdFusion detection devices.

  • concurrent tasks HAVE, AO, c, CI

    Hello

    I try to control a, AO, CI card SMU-6358 simultaneously and for that I built the VI attached. If I run the VI, it does the job without any problem, but if I connect the appliance on the pin of the IC [at the door of for example ctr0] to measure the frequency of the signal, less than a second, I get the error message "tried to play back samples that are no longer available" [image attached]. Can someone please advise me what I am doing wrong.

    Thank you.

    Hi Kriváň,

    The problem is that you have two tasks of entry in the same thread who buy data at different speeds.

    The task of IT is clocked at all that note you the value.  It crashes the loop so that the desired number of samples were acquired.

    The task of the CI is configured for 'Implied' timing, which means it will snap into place in a sample for each period of your input signal.  If the input signal is too fast then the loop (whose rate is regulated by the task to HAVE it) will not be able to follow.

    In almost all cases, if you have two tasks, acquisition of data in the same loop that they must be synchronized to ensure that a single task acquires data more quickly than the other.

    Do you need to acquire a sample of counter for each period of your input signal?  Depending on the frequency of the input signal, you might want to review the sample clocked frequency measurement method that is supported on your table for the X series.  The easiest way to get the program to work would however be to run tasks in parallel, or if you do not need to set buffer samples of your task of frequency, you could simply remove the schedule for the task of counter altogether.

    Best regards

  • Assessment of JavaFX 2.0 - treeView example

    Hello.
    I am to evaluate JavaFx 2.0 to replace our framework for the redesign of legacy applications with new capabilities. I'm looking for an example of an implementation of treeView with node, add, delete the node, rename the node, drag and drop nodes in the tree and so on. Does anyone have an example or point to some documents, book, etc..

    The documentation is not very clear for a beginner like me:(donc toute aide sera très utile, j'ai besoin de mettre àle point un prototype bientôt pour justifier une décision.)

    Thanks in advance.
    Paul

    Not everything you ask is explained here, but it would be a good start if you haven't read it already =>
    http://docs.Oracle.com/JavaFX/2.0/ui_controls/tree-view.htm#BABDEADA

    For more information you can also watch the TableView tutorial which, although a different control, works in the same way =>
    http://docs.Oracle.com/JavaFX/2.0/ui_controls/table-view.htm#CJAGAAEE

    Information on doing drag and drop work is here-online
    http://docs.Oracle.com/JavaFX/2.0/drag_drop/jfxpub-drag_drop.htm

    There is a very simple TreeView throughout, example of application =>
    http://download.Oracle.com/otndocs/products/JavaFX/2.0.2/samples/ensemble/index.html#samples/controls/tree/tree%20View

  • Control Panel, run the Task Manager, editor support and register missing because of a virus - HELP

    Hello

    A few days I got laptop from my uncle to copy some files, I plugged my USB without knowing he had a virus in there. Later, I plugged USB on my pc (which has windows xp inside) and copied the files. I noticed in my USB a folder named 'My documents', as novice I clicked on which you wonder what do my documents in USb and without knowing the virus got into my system as well. Minutes later my task manager, run, Control Panel, help and registry editor disappeared. Not only that I could not even set up the date and time as he said still not authorized by 'administrator' if I'm the administrator; and I couldn't run all the anti virus programs. You can imagine that I was powerless. I copied my C data to other readers and tried to re install windows. Once I got however the virus itself distributed sort of other readers and I opened the windows got new virus. Now my pc won't start, won't show windows, it will re-start itself over and over again and is not re boot the XP cd if I try to re install. What should I do? Could what virus be? And how do I get rid of him? Please help me with this.

    Hi mia084,

    You need to remove the infections by the virus of the computer completely.

    Start the computer in safe mode with network and then scan the computer using antivirus, see the article below for more information.

    Computer viruses: description, prevention, and recovery

    http://support.Microsoft.com/kb/129972

    A description of the options to start in Windows XP Mode

    http://support.Microsoft.com/kb/315222

    Note: Reinstalling Windows XP on the computer, you will lose all the data and documents available on the computer.

    How to install or upgrade to Windows XP
    http://support.Microsoft.com/kb/978307

  • BlackBerry 10 tasks CalDAV sync support?

    Hello.

    I am completely new to BlackBerry, but have finally got a Q5, as I need a physical keyboard and honest sales tools on my mobile and I'm sick of the cart wannabes BB, I tried. I'm thrilled to the ease of installation and usage but noticed that my CalDAV server tasks are not synchronized to the phone. I missed just set something up? I'm on the 10.3.1.1779 latest OS.

    If this support does not yet exist, it is a major problem for me because I have hundreds of tasks in various categories and one of the main reasons I got a BB should be able to see and interact with them on the go (using a physical keyboard to change.) Assuming that not only missed something, what would it add such support and about when it should?

    I'm pretty sure that is not supported. I came across this same question here:

    https://supportforums.BlackBerry.com/T5/BlackBerry-Q10/CalDAV-VTODO-support/TD-p/2445303

  • Problem of unique concurrent task of recovering data

    Hello

    I'm having a problem where my VDR unit seems to run only one backup at a time task. It works fine when it is deployed at the start (8 tasks without problem), but at some point, he returned to the only task. I also set tasks max 8 (even tried 4) via the datarecovery.ini nothing works.

    Someone at - it ideas? I hate having to redeploy this device yet and still the problem persists to jump to the top.

    There are a few articles on this problem in this forum. So up to 4 CPU there seems to be no problem, 4 GB may also work, it is a problem, but as much as I know, change default values is not supported. You can also watch it here:

    [http://communities.vmware.com/message/1571827#1571827]

  • Beginner: Question of Date validator on live docs example.

    Study this example below raise questions, I can not find easy answers for in the livedocs.

    1.) why do we need (just a structure object) model? In the date validator I note that we can not put source = "{dateInput.tyext}" "

    2.0) the model has an id of "alternateDate", this change makes no difference.

    2.1) connected to question 2, how dateValidator uses model because it has no reference to the model.

    3.) don't the code below work when you have more than 1 effective date, do you need a model and a separate validator date for each date entry field? This creates a circular problem as there seems to be a link between the dateValidator implicit and model... confused. This means that I have no way to link the models to date validators.

    Tire of http://livedocs.Adobe.com/Flex/3/HTML/Help.HTML?content=validators_1.html

        <mx:Model id="alternateDate">
            <dateInfo>
                <date>{dateInput.text}</date>
            </dateInfo>
        </mx:Model>

        <mx:DateValidator id="stringDateV"
            source="{dateInput}" property="text"
            inputFormat="dd/mm/yyyy"
            allowedFormatChars="*#~/"/>

        <mx:Form>
            <mx:FormItem label="Date of Birth (dd/mm/yyyy)">
                <mx:TextInput id="dateInput"/>
            </mx:FormItem>
            <mx:FormItem>
                <mx:Button label="Check Date" click="stringDateV.validate();"/>  
            </mx:FormItem>
        </mx:Form>

    I don't see what the model is being used for either - I suspect that it is a mistake in the documentation.

    You can not put source = "{dateInput.tyext}", but you can have source "{dateInput}" = and = 'text' property. " The example already done that, IE. He observes the TextInput control directly. If you remove the template in the example should always work.

  • Problem of multithreading with Mac system task class

    I have a class that extends the thread

    public class Convert extends Task
    
    
    

    Inside the class, I have a need to interrogate a file every 5 seconds to see if the new file has been added to it or not.

    So that's what I did, is that I did a while loop inside of which I kept the logic and I did the sleep of thread for 5 seconds.

    @Override
        protected Object call() throws Exception {
            // TODO Auto-generated method stub
            try{
                while(!Thread.currentThread().interrupted())
                {
                      //my logic to query the folder
                        Thread.sleep(5000);
                 }
                  catch (Exception e) {
                        e.printStackTrace();
                }
              return null;
        }
    
    
    

    I call this thread via an ExecutorService

    ExecutorService exec = Executors.newCachedThreadPool(new ThreadFactory() {
            @Override
            public Thread newThread(Runnable r) {
                Thread thread = new Thread(r);
                thread.setDaemon(true);
                return thread;
            }
        });
    
    
    

    and then

    exec.execute(convert123); //where convert123 is an reference of Convert class
    
    
    

    This exec.execute is called on the press of a button.

    Now, the problem is that it seems to work fine on my windows machine, but blocks the scene just when clicking the same button on a MAC system. (It works for 1 or 2 out of 10 times, IE 8 times out of 10 times, the scene just gets hanged and unresponsive)

    I have never created a thread running forever, so there might be a problem with my design, but I have no idea about it.

    I don't see anything inherently wrong with that. You get all exceptions?

    Note that there is an built-in API (not very high level) to watch directories for changes. You still need the wire without end (that you can implement a task if you want to cancel easily), but it should make your code easier (no need to survey and waiting for a fixed amount of time, at least on operating with os level file systems I look).

    The following example can run several tasks ending not quite happily on my Mac.

    import java.util.concurrent.ExecutorService;
    import java.util.concurrent.Executors;
    import java.util.concurrent.ThreadFactory;
    
    import javafx.application.Application;
    import javafx.application.Platform;
    import javafx.beans.binding.Bindings;
    import javafx.beans.property.IntegerProperty;
    import javafx.beans.property.SimpleIntegerProperty;
    import javafx.concurrent.Task;
    import javafx.concurrent.WorkerStateEvent;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.geometry.Insets;
    import javafx.geometry.Pos;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.Label;
    import javafx.scene.control.ScrollPane;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.layout.BorderPane;
    import javafx.scene.layout.VBox;
    import javafx.stage.Stage;
    
    public class NonTerminatingTaskTest extends Application {
    
        private static class CounterTask extends Task {
            private final IntegerProperty counter;
    
            private CounterTask(IntegerProperty counter) {
                this.counter = counter;
            }
    
            @Override
            public Void call() {
                while (!isCancelled()) {
                    try {
                        Thread.sleep(1000);
                        Platform.runLater(new Runnable() {
                            @Override
                            public void run() {
                                counter.set(counter.get() + 1);
                            }
                        });
                    } catch (InterruptedException exc) {
                        // allow to cancel
                    }
                }
                return null;
            }
        }
    
        @Override
        public void start(Stage primaryStage) {
            final ExecutorService exec = Executors.newCachedThreadPool(new ThreadFactory() {
                @Override
                public Thread newThread(Runnable r) {
                    Thread thread = new Thread(r);
                    thread.setDaemon(true);
                    return thread;
                }
            });
    
            final BorderPane root = new BorderPane();
            final VBox counterContainer = new VBox(5);
            counterContainer.setPadding(new Insets(10));
            final ScrollPane scroller = new ScrollPane();
            scroller.setContent(counterContainer);
            root.setCenter(scroller);
    
            final Button startCounterButton = new Button("Start new counter");
            startCounterButton.setOnAction(new EventHandler() {
                @Override
                public void handle(ActionEvent event) {
                    final Label label = new Label();
                    final IntegerProperty counter = new SimpleIntegerProperty();
                    label.textProperty().bind(Bindings.format("Count: %s", counter));
                    final Task counterTask = new CounterTask(counter);
                    counterTask.setOnCancelled(new EventHandler() {
                        @Override
                        public void handle(WorkerStateEvent event) {
                            counterContainer.getChildren().remove(label);
                        }
                    });
                    label.setOnMouseClicked(new EventHandler() {
                        @Override
                        public void handle(MouseEvent event) {
                            counterTask.cancel(true);
                        }
                    });
                    counterContainer.getChildren().add(label);
                    exec.submit(counterTask);
                }
            });
    
            startCounterButton.setAlignment(Pos.CENTER);
            root.setBottom(startCounterButton);
    
            Scene scene = new Scene(root, 200, 450);
            primaryStage.setScene(scene);
            primaryStage.show();
        }
    
        public static void main(String[] args) {
            launch(args);
        }
    }
    
  • JavaFX binding throws illegal state Exception: not on the thread of Application FX

    Hi all

    I am updating a label of a task using bindings.

    However, when I 'Bind' the label text property with a property of the task, Illegal state exception string is thrown. Saying: this is not not on the thread of JavaFX.

    The Exception occurs whenever I try to set the property of the task of the Interior string.

    Please do not suggest to use the platform. RunLater(). I want to do this through links as the values I am trying to display in the label (later on) could change too frequently, and I don't want to flood the queue of the thread of the user interface with executable objects.

    Please let me know what I'm doing wrong and what I need to change to make it work properly with links. (I'm new to links and concurrency JavaFx API)

    Here is my Code.

    public class MyTask extends Task<String>{
    
        MyTask(){
           System.out.println("Task Constructor on Thread "+Thread.currentThread().getName());
    
    
        }
        private StringProperty myStringProperty = new SimpleStringProperty(){
            {
                System.out.println("Creating stringProperty on Thread "+Thread.currentThread().getName());
            }
        };
        private final void setFileString(String value) {
            System.out.println("Setting On Thread"+Thread.currentThread().getName());
            myStringProperty.set(value); }
        public final String getFileString() { return myStringProperty.get(); }
        public final StringProperty fileStringProperty() {
            System.out.println("Fetching property On Thread"+Thread.currentThread().getName());
            return myStringProperty; }
        
        @Override
        public String call() throws Exception{
            System.out.println("Task Called on thread "+Thread.currentThread().getName());
    
    
           for(int counter=0;counter<100;counter++){
               try{
               setFileString(""+counter);
               }catch(Exception e){
                   e.printStackTrace();
               }
               Thread.sleep(100);
               System.out.println("Counter "+counter);
           }
           return "COMPLETED";
        }
    }
    
    
    public class MyService extends Service<String> {
    
    
        MyTask myTask;
    
        public MyService(){
            System.out.println("Service Constructor on Thread "+Thread.currentThread().getName());
            myTask=new MyTask();
        }
    
        @Override
        public Task createTask(){
            System.out.println("Creating task on Thread "+Thread.currentThread().getName());
            return myTask;
        }
    
    }
    
    
    public class ServiceAndTaskExperiment extends Application {
        @Override
        public void start(Stage stage) throws Exception {
            Parent root = FXMLLoader.load(getClass().getResource("Sample.fxml"));
            Scene scene = new Scene(root);
            stage.setScene(scene);
            stage.show();
        }
        public static void main(String[] args) {
            launch(args);
        }
    }
    
    
    public class SampleController implements Initializable {
        @FXML
        private Label label;
    
        @FXML
        private void handleButtonAction(ActionEvent event) {
            System.out.println("You clicked me!");
            myTestService.start(); //This will throw out exceptions when the button is clicked again, it does not matter
        }
    
        MyService myTestService=new MyService();
        @Override
        public void initialize(URL url, ResourceBundle rb) {
            label.setText("Hello World!");
            //adding the below Line causes the exception
            label.textProperty().bind(myTestService.myTask.fileStringProperty()); //removing this line removes the exception, ofcourse the label wont update.
        } 
    }
    //sample.fxml
    <?xml version="1.0" encoding="UTF-8"?>
    <?import java.lang.*?>
    <?import java.util.*?>
    <?import javafx.scene.*?>
    <?import javafx.scene.control.*?>
    <?import javafx.scene.layout.*?>
    
    
    <AnchorPane id="AnchorPane" prefHeight="200" prefWidth="320" xmlns:fx="http://javafx.com/fxml" fx:controller="serviceandtaskexperiment.SampleController">
        <children>
            <Button layoutX="126" layoutY="90" text="Click Me!" onAction="#handleButtonAction" fx:id="button" />
            <Label layoutX="126" layoutY="120" minHeight="16" minWidth="69" fx:id="label" />
        </children>
    </AnchorPane>
    
    
    
    

    And it is the output with links on:

    Output: when the link is activated label.textProperty () .bind (myTestService.myTask.fileStringProperty ());

    Service on JavaFX Application Thread constructor

    Creating string on thread JavaFX Application Thread

    Task, Builder on JavaFX Application Thread

    Get the property on request ThreadJavaFX wire

    You clicked me!

    Creating a task on a thread Thread Application JavaFX

    Task called threadThread-4

    Setting on ThreadThread-4

    java.lang.IllegalStateException: not on the application thread FX; currentThread = Thread-4

    at com.sun.javafx.tk.Toolkit.checkFxUserThread(Toolkit.java:237)

    at com.sun.javafx.tk.quantum.QuantumToolkit.checkFxUserThread(QuantumToolkit.java:398)

    to javafx.scene.Parent$ 1.onProposedChange(Parent.java:245)

    at com.sun.javafx.collections.VetoableObservableList.setAll(VetoableObservableList.java:90)

    at com.sun.javafx.collections.ObservableListWrapper.setAll(ObservableListWrapper.java:314)

    at com.sun.javafx.scene.control.skin.LabeledSkinBase.updateChildren(LabeledSkinBase.java:602)

    at com.sun.javafx.scene.control.skin.LabeledSkinBase.handleControlPropertyChanged(LabeledSkinBase.java:209)

    to com.sun.javafx.scene.control.skin.SkinBase$ 3.changed(SkinBase.java:282)

    at javafx.beans.value.WeakChangeListener.changed(WeakChangeListener.java:107)

    to com.sun.javafx.binding.ExpressionHelper$ SingleChange.fireValueChangedEvent (ExpressionHelper.java:196)

    at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:100)

    at javafx.beans.property.StringPropertyBase.fireValueChangedEvent(StringPropertyBase.java:121)

    at javafx.beans.property.StringPropertyBase.markInvalid(StringPropertyBase.java:128)

    in javafx.beans.property.StringPropertyBase.access$ 100 (StringPropertyBase.java:67)

    to javafx.beans.property.StringPropertyBase$ Listener.invalidated (StringPropertyBase.java:236)

    to com.sun.javafx.binding.ExpressionHelper$ SingleInvalidation.fireValueChangedEvent (ExpressionHelper.java:155)

    at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:100)

    at javafx.beans.property.StringPropertyBase.fireValueChangedEvent(StringPropertyBase.java:121)

    at javafx.beans.property.StringPropertyBase.markInvalid(StringPropertyBase.java:128)

    at javafx.beans.property.StringPropertyBase.set(StringPropertyBase.java:161)

    at javafx.beans.property.StringPropertyBase.set(StringPropertyBase.java:67)

    to serviceandtaskexperiment. MyTask.setFileString (MyTask.java:24)

    to serviceandtaskexperiment. MyTask.call (MyTask.java:36)

    to serviceandtaskexperiment. MyTask.call (MyTask.java:11)

    to javafx.concurrent.Task$ TaskCallable.call (Task.java:1259)

    at java.util.concurrent.FutureTask.run(FutureTask.java:262)

    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

    to java.util.concurrent.ThreadPoolExecutor$ Worker.run (ThreadPoolExecutor.java:615)

    at java.lang.Thread.run(Thread.java:724)

    Output with links removed: (label will not be updated)

    Service on JavaFX Application Thread constructor

    Creating string on thread JavaFX Application Thread

    Task, Builder on JavaFX Application Thread

    You clicked me!

    Creating a task on a thread Thread Application JavaFX

    Task called threadThread-4

    Setting on ThreadThread-4

    Counter 0

    Setting on ThreadThread-4

    1 meter

    Setting on ThreadThread-4

    2 meter

    Setting on ThreadThread-4

    If myStringProperty is bound to the textProperty of etiquette, you can only change it on the Thread of the JavaFX Application. The reason is that change its value will result in a change of the label, and changes of live parts of the graphic scene cannot be performed on the Thread of the JavaFX Application.

    Task and Service classes expose a messageProperty you could use here. The Task class has a updateMessage (...) method that changes the value of the message on the Thread of the JavaFX Application property. It also merges calls in order to prevent the flooding of this thread. If you could do the following in your MyTask.call () method:

    updateMessage(""+counter);
    

    and then in your controller just do

    label.textProperty().bind(myTestService.messageProperty());
    

    If you don't want to use the messageProperty for some reason any (for example you are already using it for something else, or you want to make something similar to a property that is not a string), you must merge the updates yourself. What follows is based on the source code of the task:

    public class MyTask extends Task {
    
         // add in the following:
        private final AtomicReference fileString = new AtomicReference<>();
    
        private void updateFileString(String text) {
            if (Platform.isFxApplicationThread()) {
                setFileString(text);
            } else {
                if (fileString.getAndSet(text) == null) {
                    Platform.runLater(new Runnable() {
                        @Override
                        public void run() {
                            final String text = fileString.getAndSet(null);
                            MyTask.this.setFileString(text);
                        }
                    });
                }
            }
        }
    
       // Now just call updateFileString(...) from your call() method
    }
    
  • First JavaFX application with time sequential process

    Hi all

    I'm working on my first JavaFX application.  I have a user (view) UI elements in place, I have a controller that works properly (with the exception that I will mention below), and I have a model that works properly (processes data correctly), but the model code was written to run under a user interface.

    What I want to do is the following.  When the user clicks on the "Run" button, the user input is passed to the model via the controller and the data is processed.  It's a do - once a sort of thing where the input is transformed into the output and that's the end of it.  The user interface can be reset and new entry provided, and all this happens again by clicking the run button.  Here's the problem: the treatment has several steps that need to occur in order, but some may take some time.  I want to provide feedback via a message (what is done) and overall progress via a progress bar (the two items in the current user interface).  The problem is that I am still very confused on how to accomplish the user comments.

    The user interface was built in SceneBuilder, and I attributed to the onMouseClicked event to call the runButtonClicked() method in the controller.

    The runButtonClicked() method calls the private methods that run the processing steps (I'll do something more intelligent exception - please ignore that for now)...

    public void runButtonClicked() {}

    runButton.setDisable (true);

    sdfFileBrowseButton.setDisable (true);

    outputFileBrowseButton.setDisable (true);

    try {}

    prepareSDFFile();

    prepareModels();

    collectDescriptors();

    makeSamples();

    evaluateSamples();

    writeResultsToTextFile (results, outputFile);

    } catch (IOException exception) {}

    System.out.println ("Caught an IOException:" + exception.getMessage ());

    } catch (JAXBException exception) {}

    System.out.println ("caught JAXBException:" + exception.getMessage ());

    }

    }

    Each of the calls in try-catch are tasks that need to be linked in the order listed.  Some of them may take a long time (for example, collectDescriptors(), evaluateSamples(), and writeResultsToTextFile().  The work is not done in the controller.  The controller creates instances of classes that do the actual work (this seems to be a departure from most of the tutorials I've seen - it seems the model and the controller are mixed in the tutorials).

    I would like to alert the user about this step is execution (by means of a message in the user interface) and at what stage of the process as a whole is in (through a progress bar).  It would be nice if the progress bar might reflect the status of each individual step (back to 0 at the beginning of the next step), but given the bar just reflect more all the advances (e.g., how many six steps were finished) would be sufficient.

    I also want to be able to manage a Cancel key event and just stop the whole process and reset the app (lose whatever work has been done is OK).

    -I can truly say what should be the best approach.  None of the examples in several tutorials, I went on that have really touched on this type of sequential process.  I would like suggestions.

    Thank you


    Dave.


    Suggested approach

    What you describe is a quite classic case to use the utility javafx.concurrent (task and Service).

    Your application is a perfect fit for the use of these services, which will provide you with:

    1. an execution thread concurrent to run your journal of the current process

    2. a feedback mechanism of thread-safe for the progress that you can link to a ProgressBar for interactive progress feedback.

    3. a feedback mechanism of thread-safe for messages that you can bind a label to your interactive status feedback.

    4 code example that illustrates the ability to cancel and restart the process.

    5, a setter callback method of success that can be configured to provide a result and decide on the success.

    6. a reminder Set accessor method failure which can be set to make an exception and to take measures in case of failure.

    Task and Service samples

    There are a lot of examples of tasks if you search for task of JavaFX.

    There are also great documentation in the javadoc task and Service .

    Here is an example of using a service of JavaFX.  The example is a bit old and uses does not use some new features of the API such as setOnSucceeded or setOnFailed, it also uses models of generator now frowned upon, however, the bulk of it is still relevant to what you want.

    Here is another sample more complicated to make 300 cards off screen and save the files in JavaFX, although I doubt that your task should be as complicated and probably a unique control service is all you need, in order to not pay too much attention to the more complicated example unless you need this kind of functionality.

    Here's another simple example for Re: create several parallel tasks into a single service, which shows in fact sequential and a side event of the stage of the tasks within a service.

    Progress can be reset between the steps, so that the message indicates the current step and progress indicates the status of the market rather than overall progress.  You can expose different processes for feeding of the overall progress back in addition to the progress of the step.

    For more help

    If you're still having problems, I'm sure someone on the forum could easily model a draft sample application illustrating the techniques based on the info you provided in your question, just ask if you would like that...

  • When the FAILURE of the Worker.State occurs in a task?

    How detect that a Worker.State has no PU occurs in a task? or say when the FAILURE of the Worker.State occurs in a task? It's when an exception occurs in the task call() method?

    Consider the code below:

    import java.io.BufferedReader;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.net.URI;
    import java.net.URISyntaxException;
    import java.net.URL;
    import java.net.URLConnection;
    import javafx.concurrent.Task;
    
    
    /**
     * Background task to fetch the all classes documentation page from a URL
     */
    public class FetchDocListTask extends Task<String> {
      private final String docsDirUrl;
    
    
      public FetchDocListTask(String docsDirUrl) {
      this.docsDirUrl = docsDirUrl;
      }
    
    
      @Override
      protected String call() throws Exception {
      System.out.println("---- FetchDocListTask  docsUrl = " + docsDirUrl);
      StringBuilder builder = new StringBuilder();
      try {
      URI uri = new URI(docsDirUrl + "allclasses-frame.html");
      URL url = uri.toURL();
      URLConnection urlConnection = url.openConnection();
      urlConnection.setConnectTimeout(5000); // set timeout to 5 secs
      InputStream in = urlConnection.getInputStream();
    
    
      BufferedReader reader = new BufferedReader(
      new InputStreamReader(in));
      String line;
      while ((line = reader.readLine()) != null) {
      builder.append(line);
      builder.append('\n');
      }
      reader.close();
      } catch (URISyntaxException e) {
      e.printStackTrace();
      }
      return builder.toString();
      }
    }
    

    When the State.FAILED occurs? In fact, I want to write a code to detect everything simply if the computer is connected to the internet. Hope to help ~

    Yes. If the call() method stops due to an unhandled exception, the condition of the property becomes IMPOSSIBLE. If a return statement is executed successfully, the ownership of the State passes to SUCCEEDED. There are no other possibilities.

    You can test it with something like:

    import javafx.application.Application;
        import javafx.concurrent.Task;
        import javafx.concurrent.WorkerStateEvent;
        import javafx.event.EventHandler;
        import javafx.scene.Scene;
        import javafx.scene.control.TextArea;
        import javafx.scene.layout.BorderPane;
        import javafx.stage.Stage;
    
        public class TaskStateTest extends Application {
            public static void main(String[] args) { launch(args); }
            @Override
            public void start(final Stage primaryStage) {
                Task exceptionHandlingTask = new Task() {
    
                    @Override
                    protected Void call() throws Exception {
                        try {
                            throw new Exception("Boom");
                        } catch (Exception exc) {
                            System.out.println(exc.getMessage() + " handled");
                        }
                        return null;
                    }
    
                };
    
                Task exceptionThrowingTask = new Task() {
    
                    @Override
                    protected Void call() throws Exception {
                        throw new Exception("Boom");
            //            return null;
                    }
    
                };
    
                final BorderPane root = new BorderPane();
                final TextArea textArea = new TextArea();
                root.setCenter(textArea);
    
                primaryStage.setScene(new Scene(root, 600, 400));
                primaryStage.show();
    
                registerHandlers(exceptionHandlingTask, "exceptionHandlingTask", textArea);
                registerHandlers(exceptionThrowingTask, "exceptionThrowingTask", textArea);
    
                Thread t1 = new Thread(exceptionHandlingTask);
                Thread t2 = new Thread(exceptionThrowingTask);
                t1.start();
                t2.start();
            }
            private void registerHandlers(final Task task, final String msg, final TextArea textArea) {
                task.setOnFailed(new EventHandler() {
    
                    @Override
                    public void handle(WorkerStateEvent event) {
                        textArea.appendText(msg + " failed\n");
                    }
    
                });
                task.setOnSucceeded(new EventHandler() {
    
                    @Override
                    public void handle(WorkerStateEvent event) {
                        textArea.appendText(msg +  " succeeded\n");
                    }
    
                });
            }
        }
    
  • Try to update the user interface with another thread

    Hello

    Start a class JavaFX from another application, and then I want to change the UI of it components. I tried to use Platform.runLater to do.

    But the GUI crashes at the start (does not display anything) for the first 5 seconds (sleep time) changes and shows.

    I want to display the GUI at first, and then after 5 seconds the GUI should be updated with the message, but with the code it hangs just first and screens below everything after 5 seconds.

    Here sampleGUI is a an application javafx with inside text fields.

    + / public class StartGame extends Application {+
    +@Override+
    + public void start (steps) riser Exception {+
    final sampleGUI gui = new sampeGUI();
    GUI. Start (training);

    + Platform.runLater (new Runnable() {+)
    +@Override+
    + public void run() {+
    + try {+
    System.out.println ("sleep now...");
    Thread.Sleep (5000);
    System.out.println ("sleep above!");
    gui.updateText ("new message");
    +} catch (InterruptedException ex) {+
    System.out.println ("exception" ex); +
    +}+
    +}+
    +});+
    +}+
    +}+
    Platform.runLater(new Runnable() {
      @Override
      public void run() {
       // ...
      }
    });
    

    causes the run method of the executable to run on the Thread of the FX Application. Since you put Thread.sleep (5000) inside the run method of your executable, sleep occurs on the Thread of the FX Application.

    The call to runLater (...) can be called from any thread, including the Thread of Application FX.

    So, if you are not in the FX Application thread, you want to:

    // any long-running task, for example
    System.out.println("Sleeping now");
    Thread.sleep(5000);
    System.out.println("Sleep over");
    Platform.runLater(new Runnable() {
      @Override
      public void run() {
        // update UI:
        gui.updateText("New Message");
      }
    });
    

    If you are on the thread of the Application of FX, which is the case in your Application.start (...) method, you must create a new thread to run your code of long duration. You can do this "manually", creating a Thread and a workable for it to run, but it is probably best to use the simultaneity of JavaFX API, which has many hooks useful for updating the user interface on the Thread of the FX Application.

    In this case, the code would look like this:

    public class StartGame extends Application {
      @Override
      public void start(Stage stage) throws Exception {
        final SampleGUI gui = new SampleGUI();
        gui.start();
        final Task waitingTask = new Task() {
          @Override
          public String call() throws Exception {
            System.out.println("Sleeping");
            Thread.sleep(5000);
            System.out.println("Sleep over!");
            return "New Message" ;
          }
        };
    
        waitingTask.setOnSucceeded(new EventHandler() {
          @Override
          public void handle(WorkerStateEvent event) {
            gui.updateMessage(waitingTask.getValue());
          }
        });
    
        ExecutorService executor = Executors.newSingleThreadExecutor();
        executor.submit(waitingTask);
      }
    }
    

    There are (probably of dozens of) other ways to use a task to do. See the API documentation [url http://docs.oracle.com/javafx/2/api/javafx/concurrent/Task.html] for the task for more information.

  • looking for best practices on the display of the data inside a TableView

    I have an app that can extract one ore more of 300,000 lines as a result of a request, and I am their display in a TableView... I use a mechanism to bring the data "off-site", when I do the query, an object with the ID of the lines is set in memory and a 'queryResultKey' went to start asking for the data set.
    The controllers send the queryResultKey saying the DAO that she already results N, the DAO will return X records (from N + 1 to N + J) or less if the total number of records is reached. At this point, records are added to the elements of the table view using an addAll to list related to the itemsProperty table.
    It works very well for early records already, but all of a sudden a Null pointer Exception is raised:
    ene 15, 2013 12:56:40 PM mx.gob.scjn.iusjfx.presentacion.tesis.TablaResultadosController$5 call
    SEVERE: null
    java.lang.NullPointerException
         at com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(ListListenerHelper.java:291)
         at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:48)
         at com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList.callObservers(ReadOnlyUnbackedObservableList.java:74)
         at javafx.scene.control.TableView$TableViewArrayListSelectionModel$3.onChanged(TableView.java:1725)
         at com.sun.javafx.collections.ListListenerHelper$SingleChange.fireValueChangedEvent(ListListenerHelper.java:134)
         at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:48)
         at com.sun.javafx.collections.ObservableListWrapper.callObservers(ObservableListWrapper.java:97)
         at com.sun.javafx.collections.ObservableListWrapper.clear(ObservableListWrapper.java:184)
         at javafx.scene.control.TableView$TableViewArrayListSelectionModel.quietClearSelection(TableView.java:2154)
         at javafx.scene.control.TableView$TableViewArrayListSelectionModel.updateSelection(TableView.java:1902)
         at javafx.scene.control.TableView$TableViewArrayListSelectionModel.access$2600(TableView.java:1681)
         at javafx.scene.control.TableView$TableViewArrayListSelectionModel$8.onChanged(TableView.java:1802)
         at com.sun.javafx.scene.control.WeakListChangeListener.onChanged(WeakListChangeListener.java:71)
         at com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(ListListenerHelper.java:291)
         at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:48)
         at com.sun.javafx.collections.ObservableListWrapper.callObservers(ObservableListWrapper.java:97)
         at com.sun.javafx.collections.ObservableListWrapper.addAll(ObservableListWrapper.java:171)
         at com.sun.javafx.collections.ObservableListWrapper.addAll(ObservableListWrapper.java:160)
         at javafx.beans.binding.ListExpression.addAll(ListExpression.java:280)
         at mx.gob.scjn.iusjfx.presentacion.tesis.TablaResultadosController$5.call(TablaResultadosController.java:433)
         at mx.gob.scjn.iusjfx.presentacion.tesis.TablaResultadosController$5.call(TablaResultadosController.java:427)
         at javafx.concurrent.Task$TaskCallable.call(Task.java:1259)
         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
         at java.util.concurrent.FutureTask.run(FutureTask.java:166)
         at java.lang.Thread.run(Thread.java:722)
    This exception multibordure inside the Thread that fills the table:
    task = new Task<Integer>() {
                @Override
                protected Integer call() throws Exception {
                    while (listaTesis.size() < pag.getLargo()) {
                        List<TesisTO> tesisParaincrustar = fac.getTesisParaLista(pag.getId(), listaTesis.size());
                        try {
                            listaTesis.addAll(tesisParaincrustar);
                        } catch (Exception exc) {
                            Logger.getLogger(TablaResultadosController.class.getName()).log(Level.SEVERE, null, exc);
                        }
                        tesisActuales.addAll(tesisParaincrustar);
                        updateProgress(listaTesis.size(), pag.getLargo());
                    }
    
                    return new Integer(100);
                }
    
                @Override
                protected void succeeded() {
                    status.getProgreso().setVisible(false);
                    preparaFiltros();
                    llenandoTabla = false;
                    tblResultados.getSelectionModel().select(0);
                }
            };
            status.getProgreso().progressProperty().bind(task.progressProperty());
            new Thread((Runnable) task).start();
    So that may be another strategy to simulate (or have) all the registry values are in memory and 'capture only the necessary links' to display them in the TableView?
    Any idea will be useful.

    The first thing I would do here is to check that

    fac.getTesisParaLista(pag.getId(), listaTesis.size())
    

    cannot return null in all circumstances. If it returns null, then it is the source of your exception. In this case, you must add the caution appropriate to your code:

    if (tesisParaincrustar != null) {
                        try {
                            listaTesis.addAll(tesisParaincrustar);
                        } catch (Exception exc) {
                            Logger.getLogger(TablaResultadosController.class.getName()).log(Level.SEVERE, null, exc);
                        }
                        tesisActuales.addAll(tesisParaincrustar);
    }
    

    For the number of thread, you can plan everything which modifies the user interface to run on the Thread of the FX Application using Platform.runLater (...). Note that any data that you pass into that must not be changed elsewhere. If you can do something like:

    Platform.runLater(new Runnable() {
      @Override
      public void run() {
                        try {
                            listaTesis.addAll(tesisParaincrustar);
                        } catch (Exception exc) {
                            Logger.getLogger(TablaResultadosController.class.getName()).log(Level.SEVERE, null, exc);
                        }
                        tesisActuales.addAll(tesisParaincrustar);
      }
    });
    

    You need to add the 'final' keyword to the declaration of tesisParaincrustar to get this to compile.

    That's fine, assuming that the call to fac.getTesisParaLista (...) returns a new instance of the list each time (i.e. it does not change an existing list).

    You'll end up with only one problem: the condition in your while loop (...) refers to listaTesis.size (). Given that this list is now updated on a different thread to the thread of the while loop (...) management. This can (and probably won't be) cause the loop to terminate at the wrong time. You can adjust the condition while (...) so it does not refer to this list (for example, advance calculate how many things must be read, give this number to your implementation of the task and use it in the while condition (...).)

    There are actually two rules for multithreading in JavaFX:
    1. do not access the user interface outside the FX request Thread. This includes data related to the user interface structures. I guess at some point you have called tableView.setItems (listaTesis), so listaTesis should be considered as part of the user interface.
    2. don't run long running on the Thread of the FX Application tasks.

    In trying to comply with rule 2, you have violated rule 1.

    The incremental updates to a list that appears in a background thread is one of the most delicate uses of the task. Read the documentation of the API for task (http://docs.oracle.com/javafx/2/api/javafx/concurrent/Task.html): the example of "PartialResultsTask" under "a task that returns partial causes" is an example of what you're trying to do.

  • Create columns dynamically

    Hello

    I'm writing an application that contains a table to display data from a file. I want to know the number of columns of data in the file, because it can vary. However, it seems that I might have a problem with the creation of methods setter/getter for properties of column as I don't know before hand the number of columns and what called I make use of PropertyValueFactory class of convenience because it uses a channel set for a parameter.

    Any suggestions?

    Thanks in advance

    You can use a list<> or ObservableList<> data for each line of the table type (thus table.getItems () will look like ObservableList<>>.) You will not be able to use a PropertyValueFactory: you define a CellValueFactory custom columns to be indexed in the correct column.

    Here is an example that reads a tabs-delimited text file and populates the table on the fly. Eventually, it reads the first line as "header values" (i.e. of the column titles) and then each line. If a row has more columns that are currently in the table, it adds additional columns. Analysis of tabs is not intended to be the quality of the production (without tab quotes are supported, etc.).

    Enter the URL of a tabs-delimited text file and press ENTER to see work. (If you have a folder on your file system, use file:///absolute.path.to.file.txt.)

    import java.io.BufferedReader;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.net.URL;
    import java.net.URLConnection;
    
    import javafx.application.Application;
    import javafx.application.Platform;
    import javafx.beans.property.SimpleStringProperty;
    import javafx.beans.property.StringProperty;
    import javafx.beans.value.ObservableValue;
    import javafx.collections.FXCollections;
    import javafx.collections.ObservableList;
    import javafx.concurrent.Task;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Scene;
    import javafx.scene.control.CheckBox;
    import javafx.scene.control.Label;
    import javafx.scene.control.TableColumn;
    import javafx.scene.control.TableView;
    import javafx.scene.control.TextField;
    import javafx.scene.control.TableColumn.CellDataFeatures;
    import javafx.scene.layout.BorderPane;
    import javafx.scene.layout.HBox;
    import javafx.scene.layout.Priority;
    import javafx.stage.Stage;
    import javafx.util.Callback;
    
    public class DynamicTable extends Application {
    
      @Override
      public void start(Stage primaryStage) {
        final BorderPane root = new BorderPane();
        final TableView> table = new TableView<>();
        final TextField urlTextEntry = new TextField();
        urlTextEntry.setPromptText("Enter URL of tab delimited file");
        final CheckBox headerCheckBox = new CheckBox("Data has header line");
        urlTextEntry.setOnAction(new EventHandler() {
          @Override
          public void handle(ActionEvent event) {
            populateTable(table, urlTextEntry.getText(),
                headerCheckBox.isSelected());
          }
        });
        HBox controls = new HBox();
        controls.getChildren().addAll(urlTextEntry, headerCheckBox);
        HBox.setHgrow(urlTextEntry, Priority.ALWAYS);
        HBox.setHgrow(headerCheckBox, Priority.NEVER);
        root.setTop(controls);
        root.setCenter(table);
        Scene scene = new Scene(root, 600, 400);
        primaryStage.setScene(scene);
        primaryStage.show();
      }
    
      private void populateTable(
          final TableView> table,
          final String urlSpec, final boolean hasHeader) {
        table.getItems().clear();
        table.getColumns().clear();
        table.setPlaceholder(new Label("Loading..."));
        Task task = new Task() {
          @Override
          protected Void call() throws Exception {
            BufferedReader in = getReaderFromUrl(urlSpec);
            // Header line
            if (hasHeader) {
              final String headerLine = in.readLine();
              final String[] headerValues = headerLine.split("\t");
              Platform.runLater(new Runnable() {
                @Override
                public void run() {
                  for (int column = 0; column < headerValues.length; column++) {
                    table.getColumns().add(
                        createColumn(column, headerValues[column]));
                  }
                }
              });
            }
    
            // Data:
    
            String dataLine;
            while ((dataLine = in.readLine()) != null) {
              final String[] dataValues = dataLine.split("\t");
              Platform.runLater(new Runnable() {
                @Override
                public void run() {
                  // Add additional columns if necessary:
                  for (int columnIndex = table.getColumns().size(); columnIndex < dataValues.length; columnIndex++) {
                    table.getColumns().add(createColumn(columnIndex, ""));
                  }
                  // Add data to table:
                  ObservableList data = FXCollections
                      .observableArrayList();
                  for (String value : dataValues) {
                    data.add(new SimpleStringProperty(value));
                  }
                  table.getItems().add(data);
                }
              });
            }
            return null;
          }
        };
        Thread thread = new Thread(task);
        thread.setDaemon(true);
        thread.start();
      }
    
      private TableColumn, String> createColumn(
          final int columnIndex, String columnTitle) {
        TableColumn, String> column = new TableColumn<>();
        String title;
        if (columnTitle == null || columnTitle.trim().length() == 0) {
          title = "Column " + (columnIndex + 1);
        } else {
          title = columnTitle;
        }
        column.setText(title);
        column
            .setCellValueFactory(new Callback, String>, ObservableValue>() {
              @Override
              public ObservableValue call(
                  CellDataFeatures, String> cellDataFeatures) {
                ObservableList values = cellDataFeatures.getValue();
                if (columnIndex >= values.size()) {
                  return new SimpleStringProperty("");
                } else {
                  return cellDataFeatures.getValue().get(columnIndex);
                }
              }
            });
        return column;
      }
    
      private BufferedReader getReaderFromUrl(String urlSpec) throws Exception {
        URL url = new URL(urlSpec);
        URLConnection connection = url.openConnection();
        InputStream in = connection.getInputStream();
        return new BufferedReader(new InputStreamReader(in));
      }
    
      public static void main(String[] args) {
        launch(args);
      }
    }
    

Maybe you are looking for

  • Whenever I have turn off my pc and reboot later, the time and date go to 0.00

    Original title : improve system performance slow slow start Whenever I have turn off my pc and reboot later, the time and date go to 0.00

  • Update Vista Microsoft error number: 0x8DDD0002

    I am unable to do the update of windows on my windows vista computer. Now to clarify things, I can access and complete Windows Update in my Start menu but when I try to access it through my internet explore I get the error error number: 0x8DDD0002 To

  • The upgrade of the HPE H8 - 1240T

    Hello I think I have a HPE H8 - 1240t http://h10025.www1.HP.com/ewfrf/wc/product?cc=us&DLC=en&LC=en&product=5193499& I was wondering if this PC uses specific parts of HP.  My current PC is a Dell and a few years back I tried to upgrade the video card

  • Data growing in vmware esx server disk 3

    Hi, I have been asked by a colleague If I can be useful to expand d: ------disc on an existing virtual windows server 2003.They use:VMware ESX Server 3i Version 3.5.0 Build 110271VMware Infrastructure Client Version 2.5.0 build 119826Is it possible t

  • Why my photoshop closes as soon as it opens

    As soon as I open my Adobe Photoshop his farm almost instantly saying anything. What is the cause of this and how to fix it?