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

Scale = 0 in conjunction with MouseEvent results in ClassCastException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • fx1.2
    • None
    • javafx
    • None
    • Version 1.1

      When a node has scale attribute set to zero and a mouse event is subsequently fired on the object, then a ClassCastException is reported in the log; however, the application does not crash.

      Click once on the red rectangle and then click again on the very same spot to reproduce the error.

      Workaround: Set the scale value to a very small value, e.g. 0.0001.

      import javafx.scene.Group;
      import javafx.scene.input.MouseEvent;
      import javafx.scene.paint.Color;
      import javafx.scene.Scene;
      import javafx.scene.shape.Rectangle;
      import javafx.stage.Stage;

      Stage {
          width: 250
          height: 250
          scene: Scene {
              content: Group {
                  var scale = 1.0;
                  content: [
                      Rectangle {
                          x: 10
                          y: 10
                          width: 40
                          height: 40
                          scaleX: bind scale
                          fill: Color.RED
                          onMouseReleased: function(e:MouseEvent) {
                              scale = 0.0;
                          }
                      }
                  ]
              }
          }
      }

            rbair Richard Bair (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: