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

SwingNode: Swing events should not be dispatched if content is not set

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8
    • 8
    • javafx
    • Win7-64

      Reproduced on b91.

      When the content is not set, SwingNode generates awt/swing events which lead to the following exception:

      JavaFX Application Thread uncaught: java.lang.IllegalArgumentException
      java.lang.IllegalArgumentException: null source
      at java.util.EventObject.<init>(EventObject.java:56)
      at java.awt.AWTEvent.<init>(AWTEvent.java:337)
      at java.awt.event.ComponentEvent.<init>(ComponentEvent.java:120)
      at java.awt.event.InputEvent.<init>(InputEvent.java:340)
      at java.awt.event.MouseEvent.<init>(MouseEvent.java:736)
      at javafx.embed.swing.SwingNode$SwingMouseEventHandler.handle(SwingNode.java:600)
      at javafx.embed.swing.SwingNode$SwingMouseEventHandler.handle(SwingNode.java:579)
      at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
      at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
      at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
      at javafx.event.Event.fireEvent(Event.java:202)
      at com.sun.javafx.event.EventQueue.fire(EventQueue.java:48)
      at javafx.scene.Scene$MouseHandler.handleEnterExit(Scene.java:3548)
      at javafx.scene.Scene$MouseHandler.process(Scene.java:3614)
      at javafx.scene.Scene$MouseHandler.process(Scene.java:3463)
      at javafx.scene.Scene$MouseHandler.access$1900(Scene.java:3415)
      at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1692)
      at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2483)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:312)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:237)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:354)
      at com.sun.glass.ui.View.handleMouseEvent(View.java:514)
      at com.sun.glass.ui.View.notifyMouse(View.java:877)
      at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
      at com.sun.glass.ui.win.WinApplication.access$300(WinApplication.java:39)
      at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:101)
      at java.lang.Thread.run(Thread.java:724)



      Code to reproduce (mouse over or press key to generate the exceptions):

      import javafx.application.Application;
      import javafx.embed.swing.SwingNode;
      import javafx.scene.Scene;
      import javafx.scene.layout.StackPane;
      import javafx.stage.Stage;

      public class SwingNodeEventHandler extends Application {
      private SwingNode swingNode;

      @Override
      public void start(Stage stage) {
      StackPane root = new StackPane();
      swingNode = new SwingNode();
      root.getChildren().add(swingNode);

      Scene scene = new Scene(root, 800, 800);
      stage.setScene(scene);
      stage.show();
      }

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

            ant Anton Tarasov (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: