Exception in thread "JavaFX Application Thread" java.lang.NullPointerException: Cannot read the array length because "this.lines" is null

День добрый. Только начал изучать JavaFX. Решил написать простенький секундомер и каждый раз при запуске программы появляется огромное кол-во ошибок и зависает программа:

Exception in thread "JavaFX Application Thread" java.lang.NullPointerException: Cannot read the array length because "this.lines" is null
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.layout(PrismTextLayout.java:1208)
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.ensureLayout(PrismTextLayout.java:222)
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.getBounds(PrismTextLayout.java:245)
    at javafx.graphics/javafx.scene.text.Text.getLogicalBounds(Text.java:430)
    at javafx.graphics/javafx.scene.text.Text.doComputeLayoutBounds(Text.java:1124)
    at javafx.graphics/javafx.scene.text.Text.access$200(Text.java:127)
    at javafx.graphics/javafx.scene.text.Text$1.doComputeLayoutBounds(Text.java:142)
    at javafx.graphics/com.sun.javafx.scene.shape.TextHelper.computeLayoutBoundsImpl(TextHelper.java:95)
    at javafx.graphics/com.sun.javafx.scene.NodeHelper.computeLayoutBounds(NodeHelper.java:106)
    at javafx.graphics/javafx.scene.Node$13.computeBounds(Node.java:3499)
    at javafx.graphics/javafx.scene.Node$LazyBoundsProperty.get(Node.java:9764)
    at javafx.graphics/javafx.scene.Node$LazyBoundsProperty.get(Node.java:9734)
    at javafx.graphics/javafx.scene.Node.getLayoutBounds(Node.java:3514)
    at javafx.graphics/javafx.scene.layout.AnchorPane.computeWidth(AnchorPane.java:272)
    at javafx.graphics/javafx.scene.layout.AnchorPane.computeMinWidth(AnchorPane.java:248)
    at javafx.graphics/javafx.scene.Parent.minWidth(Parent.java:1045)
    at javafx.graphics/javafx.scene.layout.Region.minWidth(Region.java:1507)
    at javafx.graphics/javafx.scene.layout.Region.computeChildPrefAreaWidth(Region.java:1946)
    at javafx.graphics/javafx.scene.layout.AnchorPane.computeChildWidth(AnchorPane.java:315)
    at javafx.graphics/javafx.scene.layout.AnchorPane.layoutChildren(AnchorPane.java:353)
    at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1204)
    at javafx.graphics/javafx.scene.Scene.doLayoutPass(Scene.java:576)
    at javafx.graphics/javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2482)
    at javafx.graphics/com.sun.javafx.tk.Toolkit.lambda$runPulse$2(Toolkit.java:412)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
    at javafx.graphics/com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:411)
    at javafx.graphics/com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:438)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:519)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:499)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:492)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$11(QuantumToolkit.java:320)
    at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException: Cannot read the array length because "this.runs" is null
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.addTextRun(PrismTextLayout.java:756)
    at javafx.graphics/com.sun.javafx.text.GlyphLayout.addTextRun(GlyphLayout.java:140)
    at javafx.graphics/com.sun.javafx.text.GlyphLayout.breakRuns(GlyphLayout.java:312)
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.buildRuns(PrismTextLayout.java:771)
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.layout(PrismTextLayout.java:1022)
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.ensureLayout(PrismTextLayout.java:222)
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.getBounds(PrismTextLayout.java:245)
    at javafx.graphics/javafx.scene.text.Text.getLogicalBounds(Text.java:430)
    at javafx.graphics/javafx.scene.text.Text.doComputeGeomBounds(Text.java:1173)
    at javafx.graphics/javafx.scene.text.Text.access$300(Text.java:127)
    at javafx.graphics/javafx.scene.text.Text$1.doComputeGeomBounds(Text.java:148)
    at javafx.graphics/com.sun.javafx.scene.shape.TextHelper.computeGeomBoundsImpl(TextHelper.java:90)
    at javafx.graphics/com.sun.javafx.scene.NodeHelper.computeGeomBounds(NodeHelper.java:115)
    at javafx.graphics/javafx.scene.Node.updateGeomBounds(Node.java:3837)
    at javafx.graphics/javafx.scene.Node.getGeomBounds(Node.java:3799)
    at javafx.graphics/javafx.scene.Node.getLocalBounds(Node.java:3747)
    at javafx.graphics/javafx.scene.Node.updateTxBounds(Node.java:3901)
    at javafx.graphics/javafx.scene.Node.getTransformedBounds(Node.java:3693)
    at javafx.graphics/javafx.scene.Node.updateBounds(Node.java:766)
    at javafx.graphics/javafx.scene.Parent.updateBounds(Parent.java:1830)
    at javafx.graphics/javafx.scene.Parent.updateBounds(Parent.java:1830)
    at javafx.graphics/javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2497)
    at javafx.graphics/com.sun.javafx.tk.Toolkit.lambda$runPulse$2(Toolkit.java:412)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
    at javafx.graphics/com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:411)
    at javafx.graphics/com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:438)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:519)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:499)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:492)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$11(QuantumToolkit.java:320)
    at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException: Cannot read the array length because "this.runs" is null
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.addTextRun(PrismTextLayout.java:756)
    at javafx.graphics/com.sun.javafx.text.GlyphLayout.addTextRun(GlyphLayout.java:140)
    at javafx.graphics/com.sun.javafx.text.GlyphLayout.breakRuns(GlyphLayout.java:312)
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.buildRuns(PrismTextLayout.java:771)
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.layout(PrismTextLayout.java:1022)
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.ensureLayout(PrismTextLayout.java:222)
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.getBounds(PrismTextLayout.java:245)
    at javafx.graphics/javafx.scene.text.Text.getLogicalBounds(Text.java:430)
    at javafx.graphics/javafx.scene.text.Text.doComputeGeomBounds(Text.java:1173)
    at javafx.graphics/javafx.scene.text.Text.access$300(Text.java:127)
    at javafx.graphics/javafx.scene.text.Text$1.doComputeGeomBounds(Text.java:148)
    at javafx.graphics/com.sun.javafx.scene.shape.TextHelper.computeGeomBoundsImpl(TextHelper.java:90)
    at javafx.graphics/com.sun.javafx.scene.NodeHelper.computeGeomBounds(NodeHelper.java:115)
    at javafx.graphics/javafx.scene.Node.updateGeomBounds(Node.java:3837)
    at javafx.graphics/javafx.scene.Node.getGeomBounds(Node.java:3799)
    at javafx.graphics/javafx.scene.Node.getLocalBounds(Node.java:3747)
    at javafx.graphics/javafx.scene.Node.updateTxBounds(Node.java:3901)
    at javafx.graphics/javafx.scene.Node.getTransformedBounds(Node.java:3693)
    at javafx.graphics/javafx.scene.Node.updateBounds(Node.java:766)
    at javafx.graphics/javafx.scene.Parent.updateBounds(Parent.java:1830)
    at javafx.graphics/javafx.scene.Parent.updateBounds(Parent.java:1830)
    at javafx.graphics/javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2497)
    at javafx.graphics/com.sun.javafx.tk.Toolkit.lambda$runPulse$2(Toolkit.java:412)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
    at javafx.graphics/com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:411)
    at javafx.graphics/com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:438)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:519)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:499)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:492)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$11(QuantumToolkit.java:320)
    at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException: Cannot read the array length because "this.runs" is null
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.addTextRun(PrismTextLayout.java:756)
    at javafx.graphics/com.sun.javafx.text.GlyphLayout.addTextRun(GlyphLayout.java:140)
    at javafx.graphics/com.sun.javafx.text.GlyphLayout.breakRuns(GlyphLayout.java:312)
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.buildRuns(PrismTextLayout.java:771)
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.layout(PrismTextLayout.java:1022)
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.ensureLayout(PrismTextLayout.java:222)
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.getBounds(PrismTextLayout.java:245)
    at javafx.graphics/javafx.scene.text.Text.getLogicalBounds(Text.java:430)
    at javafx.graphics/javafx.scene.text.Text.doComputeGeomBounds(Text.java:1173)
    at javafx.graphics/javafx.scene.text.Text.access$300(Text.java:127)
    at javafx.graphics/javafx.scene.text.Text$1.doComputeGeomBounds(Text.java:148)
    at javafx.graphics/com.sun.javafx.scene.shape.TextHelper.computeGeomBoundsImpl(TextHelper.java:90)
    at javafx.graphics/com.sun.javafx.scene.NodeHelper.computeGeomBounds(NodeHelper.java:115)
    at javafx.graphics/javafx.scene.Node.updateGeomBounds(Node.java:3837)
    at javafx.graphics/javafx.scene.Node.getGeomBounds(Node.java:3799)
    at javafx.graphics/javafx.scene.Node.getLocalBounds(Node.java:3747)
    at javafx.graphics/javafx.scene.Node.updateTxBounds(Node.java:3901)
    at javafx.graphics/javafx.scene.Node.getTransformedBounds(Node.java:3693)
    at javafx.graphics/javafx.scene.Node.updateBounds(Node.java:766)
    at javafx.graphics/javafx.scene.Parent.updateBounds(Parent.java:1830)
    at javafx.graphics/javafx.scene.Parent.updateBounds(Parent.java:1830)
    at javafx.graphics/javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2497)
    at javafx.graphics/com.sun.javafx.tk.Toolkit.lambda$runPulse$2(Toolkit.java:412)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
    at javafx.graphics/com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:411)
    at javafx.graphics/com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:438)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:519)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:499)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:492)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$11(QuantumToolkit.java:320)
    at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException: Cannot read the array length because "this.lines" is null
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.layout(PrismTextLayout.java:1268)
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.ensureLayout(PrismTextLayout.java:222)
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.getBounds(PrismTextLayout.java:245)
    at javafx.graphics/javafx.scene.text.Text.getLogicalBounds(Text.java:430)
    at javafx.graphics/javafx.scene.text.Text.doComputeGeomBounds(Text.java:1173)
    at javafx.graphics/javafx.scene.text.Text.access$300(Text.java:127)
    at javafx.graphics/javafx.scene.text.Text$1.doComputeGeomBounds(Text.java:148)
    at javafx.graphics/com.sun.javafx.scene.shape.TextHelper.computeGeomBoundsImpl(TextHelper.java:90)
    at javafx.graphics/com.sun.javafx.scene.NodeHelper.computeGeomBounds(NodeHelper.java:115)
    at javafx.graphics/javafx.scene.Node.updateGeomBounds(Node.java:3837)
    at javafx.graphics/javafx.scene.Node.getGeomBounds(Node.java:3799)
    at javafx.graphics/javafx.scene.Node.getLocalBounds(Node.java:3747)
    at javafx.graphics/javafx.scene.Node.updateTxBounds(Node.java:3901)
    at javafx.graphics/javafx.scene.Node.getTransformedBounds(Node.java:3693)
    at javafx.graphics/javafx.scene.Node.updateBounds(Node.java:766)
    at javafx.graphics/javafx.scene.Parent.updateBounds(Parent.java:1830)
    at javafx.graphics/javafx.scene.Parent.updateBounds(Parent.java:1830)
    at javafx.graphics/javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2497)
    at javafx.graphics/com.sun.javafx.tk.Toolkit.lambda$runPulse$2(Toolkit.java:412)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
    at javafx.graphics/com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:411)
    at javafx.graphics/com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:438)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:519)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:499)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:492)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$11(QuantumToolkit.java:320)
    at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException: Cannot read the array length because "this.lines" is null
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.layout(PrismTextLayout.java:1268)
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.ensureLayout(PrismTextLayout.java:222)
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.getBounds(PrismTextLayout.java:245)
    at javafx.graphics/javafx.scene.text.Text.getLogicalBounds(Text.java:430)
    at javafx.graphics/javafx.scene.text.Text.doComputeGeomBounds(Text.java:1173)
    at javafx.graphics/javafx.scene.text.Text.access$300(Text.java:127)
    at javafx.graphics/javafx.scene.text.Text$1.doComputeGeomBounds(Text.java:148)
    at javafx.graphics/com.sun.javafx.scene.shape.TextHelper.computeGeomBoundsImpl(TextHelper.java:90)
    at javafx.graphics/com.sun.javafx.scene.NodeHelper.computeGeomBounds(NodeHelper.java:115)
    at javafx.graphics/javafx.scene.Node.updateGeomBounds(Node.java:3837)
    at javafx.graphics/javafx.scene.Node.getGeomBounds(Node.java:3799)
    at javafx.graphics/javafx.scene.Node.getLocalBounds(Node.java:3747)
    at javafx.graphics/javafx.scene.Node.updateTxBounds(Node.java:3901)
    at javafx.graphics/javafx.scene.Node.getTransformedBounds(Node.java:3693)
    at javafx.graphics/javafx.scene.Node.updateBounds(Node.java:766)
    at javafx.graphics/javafx.scene.Parent.updateBounds(Parent.java:1830)
    at javafx.graphics/javafx.scene.Parent.updateBounds(Parent.java:1830)
    at javafx.graphics/javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2497)
    at javafx.graphics/com.sun.javafx.tk.Toolkit.lambda$runPulse$2(Toolkit.java:412)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
    at javafx.graphics/com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:411)
    at javafx.graphics/com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:438)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:519)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:499)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:492)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$11(QuantumToolkit.java:320)
    at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException: Cannot read the array length because "this.runs" is null
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.addTextRun(PrismTextLayout.java:756)
    at javafx.graphics/com.sun.javafx.text.GlyphLayout.addTextRun(GlyphLayout.java:140)
    at javafx.graphics/com.sun.javafx.text.GlyphLayout.breakRuns(GlyphLayout.java:312)
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.buildRuns(PrismTextLayout.java:771)
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.layout(PrismTextLayout.java:1022)
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.ensureLayout(PrismTextLayout.java:222)
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.getBounds(PrismTextLayout.java:245)
    at javafx.graphics/javafx.scene.text.Text.getLogicalBounds(Text.java:430)
    at javafx.graphics/javafx.scene.text.Text.doComputeGeomBounds(Text.java:1173)
    at javafx.graphics/javafx.scene.text.Text.access$300(Text.java:127)
    at javafx.graphics/javafx.scene.text.Text$1.doComputeGeomBounds(Text.java:148)
    at javafx.graphics/com.sun.javafx.scene.shape.TextHelper.computeGeomBoundsImpl(TextHelper.java:90)
    at javafx.graphics/com.sun.javafx.scene.NodeHelper.computeGeomBounds(NodeHelper.java:115)
    at javafx.graphics/javafx.scene.Node.updateGeomBounds(Node.java:3837)
    at javafx.graphics/javafx.scene.Node.getGeomBounds(Node.java:3799)
    at javafx.graphics/javafx.scene.Node.getLocalBounds(Node.java:3747)
    at javafx.graphics/javafx.scene.Node.updateTxBounds(Node.java:3901)
    at javafx.graphics/javafx.scene.Node.getTransformedBounds(Node.java:3693)
    at javafx.graphics/javafx.scene.Node.updateBounds(Node.java:766)
    at javafx.graphics/javafx.scene.Parent.updateBounds(Parent.java:1830)
    at javafx.graphics/javafx.scene.Parent.updateBounds(Parent.java:1830)
    at javafx.graphics/javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2497)
    at javafx.graphics/com.sun.javafx.tk.Toolkit.lambda$runPulse$2(Toolkit.java:412)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
    at javafx.graphics/com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:411)
    at javafx.graphics/com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:438)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:519)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:499)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:492)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$11(QuantumToolkit.java:320)
    at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException: Cannot read the array length because "this.lines" is null
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.layout(PrismTextLayout.java:1268)
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.ensureLayout(PrismTextLayout.java:222)
    at javafx.graphics/com.sun.javafx.text.PrismTextLayout.getBounds(PrismTextLayout.java:245)
    at javafx.graphics/javafx.scene.text.Text.getLogicalBounds(Text.java:430)
    at javafx.graphics/javafx.scene.text.Text.doComputeGeomBounds(Text.java:1173)
    at javafx.graphics/javafx.scene.text.Text.access$300(Text.java:127)
    at javafx.graphics/javafx.scene.text.Text$1.doComputeGeomBounds(Text.java:148)
    at javafx.graphics/com.sun.javafx.scene.shape.TextHelper.computeGeomBoundsImpl(TextHelper.java:90)
    at javafx.graphics/com.sun.javafx.scene.NodeHelper.computeGeomBounds(NodeHelper.java:115)
    at javafx.graphics/javafx.scene.Node.updateGeomBounds(Node.java:3837)
    at javafx.graphics/javafx.scene.Node.getGeomBounds(Node.java:3799)
    at javafx.graphics/javafx.scene.Node.getLocalBounds(Node.java:3747)
    at javafx.graphics/javafx.scene.Node.updateTxBounds(Node.java:3901)
    at javafx.graphics/javafx.scene.Node.getTransformedBounds(Node.java:3693)
    at javafx.graphics/javafx.scene.Node.updateBounds(Node.java:766)
    at javafx.graphics/javafx.scene.Parent.updateBounds(Parent.java:1830)
    at javafx.graphics/javafx.scene.Parent.updateBounds(Parent.java:1830)
    at javafx.graphics/javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2497)
    at javafx.graphics/com.sun.javafx.tk.Toolkit.lambda$runPulse$2(Toolkit.java:412)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
    at javafx.graphics/com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:411)
    at javafx.graphics/com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:438)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:519)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:499)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:492)
    at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$11(QuantumToolkit.java:320)
    at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)

Вот Main.java:

package sample;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class Main extends Application {


    @Override
    public void start(Stage primaryStage) throws Exception{

        Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
        primaryStage.setTitle("Stopwatch");
        primaryStage.setScene(new Scene(root, 700, 400));
        primaryStage.show();
    }


    public static void main(String[] args) {
        Application.launch(args);
    }
}

Мой Controller.java:

package sample;

import java.net.URL;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.ResourceBundle;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;

import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.text.Text;

public class Controller {

    @FXML
    private ResourceBundle resources;

    @FXML
    private URL location;

    @FXML
    private Button stopBtn;

    @FXML
    private Button startBtn;

    @FXML
    private Text seconds;

    @FXML
    void initialize() throws ParseException {
        AtomicBoolean ss = new AtomicBoolean(true);
        Date kk = new Date();
        AtomicInteger k = new AtomicInteger();
        AtomicInteger z = new AtomicInteger();
        stopBtn.setOnAction(event -> {
            stopBtn.setText("STOP");
            startBtn.setVisible(true);
            ss.set(false);
            z.set(z.get() + 1);

            if (z.get() == 2){
                k.set(0);
                z.set(0);
                stopBtn.setVisible(false);
                seconds.setText("00:00.000");
            }
        });
        startBtn.setOnAction(event -> {

            stopBtn.setVisible(true);
            startBtn.setVisible(false);
            z.set(0);


            ss.set(true);
            new Thread() {

                public void run() {

                    while (ss.get()) {
                        k.set(k.get() + 10);
                        seconds.setText(new SimpleDateFormat("mm:ss.SSS").format(k.get()));
                        try {
                            Thread.sleep(10);
                        } catch (Exception e) {
                        }
                    }
                }

            }.start();
        });
    }

}

Мой sample.fxml:

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.Cursor?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>

<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="700.0" style="-fx-background-color: #023B3F#023B3F;" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml" fx:controller="sample.Controller">
   <children>
      <AnchorPane layoutY="105.0" prefHeight="295.0" prefWidth="700.0" style="-fx-background-color: #fafafa;">
         <children>
            <Button fx:id="stopBtn" cache="true" layoutX="42.0" layoutY="193.0" mnemonicParsing="false" prefHeight="60.0" prefWidth="121.0" style="-fx-background-color: #DC1104#DC1104;" text="PAUSE" textAlignment="CENTER" textFill="WHITE" visible="false">
               <font>
                  <Font size="24.0" />
               </font>
               <cursor>
                  <Cursor fx:constant="DEFAULT" />
               </cursor>
            </Button>
            <Button fx:id="startBtn" layoutX="531.0" layoutY="193.0" mnemonicParsing="false" prefHeight="60.0" prefWidth="121.0" style="-fx-background-color: #27C109#27C109;" text="START" textAlignment="CENTER" textFill="WHITE">
               <font>
                  <Font size="24.0" />
               </font>
            </Button>
            <Text fx:id="seconds" layoutX="216.0" layoutY="101.0" strokeType="OUTSIDE" strokeWidth="0.0" text="00:00.000" textAlignment="CENTER" wrappingWidth="267.888671875">
               <font>
                  <Font size="56.0" />
               </font>
            </Text>
         </children>
         <cursor>
            <Cursor fx:constant="DEFAULT" />
         </cursor>
      </AnchorPane>
      <Label layoutX="296.0" layoutY="32.0" text="Time:" textFill="WHITE">
         <font>
            <Font name="Wingdings 2" size="43.0" />
         </font>
      </Label>
   </children>
</AnchorPane>

Не понимаю уже второй день почему это происходит. Заранее спасибо.


Ответы (0 шт):