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

Scale = 0 in conjunction with MouseEvent results in ClassCastException

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: fx1.2
    • Component/s: javafx
    • Labels:
      None
    • Environment:

      Version 1.1

      Description

      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;
                          }
                      }
                  ]
              }
          }
      }

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:
              Imported: