Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8109093

Text throws exception when strikethrough is removed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • fx1.3
    • fx1.3
    • javafx
    • soma graphics scrum #1154, swing pipeline

      This issue occurs with soma graphics scrum #1154, but works fine with 1.2.3.
      I've a Text (with both strikethrough and underline set) and a Rectangle drawn binding the Text's bounds (happens with boundsInLocal, boundsInParent or layoutBounds). When the Text's 'strikethrough' value is changed, the following exception is thrown on console

      Unexpected exception caught in MasterTimer.timePulse():
      java.lang.NullPointerException
      at com.sun.scenario.scenegraph.SGText.padBounds(SGText.java:899)
      at com.sun.scenario.scenegraph.SGText.computeBounds(SGText.java:860)
      at com.sun.javafx.tk.swing.SwingTextHelper.computeBounds(SwingTextHelper.fx:24)
      at javafx.scene.text.Text.impl_computeGeomBounds(Text.fx:573)
      at javafx.scene.Node.updateGeomBounds(Node.fx:1853)
      at javafx.scene.Node.getGeomBounds(Node.fx:1823)
      at javafx.scene.Node.getLocalBounds(Node.fx:1807)
      at javafx.scene.Node.contains(Node.fx:1320)
      at javafx.scene.Node.impl_pick(Node.fx:2233)
      at javafx.scene.Node.pick(Node.fx:2223)
      at javafx.scene.Scene$MouseHandler.pick(Scene.fx:1495)
      at javafx.scene.Scene$MouseHandler.process(Scene.fx:1341)
      at javafx.scene.Scene$MouseHandler.pulse(Scene.fx:1288)
      at javafx.scene.Scene$ScenePulseListener.pulse(Scene.fx:806)
      at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.fx:143)
      at com.sun.javafx.tk.Toolkit.handleMasterTimerPulse(Toolkit.fx:132)
      at com.sun.javafx.tk.Toolkit$1com$ObjLit$3.firePulseImpl(Toolkit.fx:304)
      at com.sun.scenario.ToolkitAccessor.firePulse(ToolkitAccessor.java:55)
      at com.sun.scenario.scenegraph.JSGPanelRepainter$FrameDisplay.run(JSGPanelRepainter.java:133)
      at com.sun.scenario.animation.AbstractMasterTimer.timePulseImpl(AbstractMasterTimer.java:412)
      at com.sun.scenario.animation.AbstractMasterTimer$MainLoop.run(AbstractMasterTimer.java:288)
      at com.sun.embeddedswing.EmbeddedEventQueue.doPulse(EmbeddedEventQueue.java:569)

      To reproduce, run the below test. It should show a Text and a transparent blue Rectangle over it. Text has both underline and strikethrough set. Click on the text to change strikethrough. Exception is thrown.

      import javafx.scene.*;
      import javafx.stage.*;
      import javafx.scene.text.*;
      import javafx.scene.shape.*;
      import javafx.scene.paint.*;

      var t1: Text;
      var strikethrough: Boolean = true;
      var underline: Boolean = true;
      Stage {
          scene: Scene {
              content: [t1 = Text {
                  x: 40
                  y: 50
                  content: "ABCD"
                  strikethrough: bind strikethrough
                  underline: true
                  onMouseClicked: function(e) {
                      strikethrough = false;
                  }
              }, Rectangle {
                  x: bind t1.boundsInLocal.minX
                  y: bind t1.boundsInLocal.minY
                  width: bind t1.boundsInLocal.width
                  height: bind t1.boundsInLocal.height
                  opacity: 0.4
                  fill: Color.BLUE
              }]
          }
      }

            prr Philip Race
            gramachasunw Girish Ramachandran (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: