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

introduce a node to embed Swing into JavaFX

XMLWordPrintable

      As part of Swing/FX interoperability efforts, a new JavaFX node should be created to embed Swing content into JavaFX applications. Following is the proposed API:

      public class SwingNode extends Node {
        /**
          * Attaches a {@code JComponent} instance to display in this {@code SwingNode}.
          * <p>
          * The method can be called either on the JavaFX Application thread or the Swing thread.
          * Note however, that access to a Swing component must occur from the Swing thread according
          * to the Swing threading restrictions.
          *
          * @param content a Swing component to display in this {@code SwingNode}
          *
          * @see java.awt.EventQueue#isDispatchThread()
          * @see javafx.application.Platform#isFxApplicationThread()
          */
         public void setContent(final JComponent content);

        /**
          * Returns the {@code JComponent} instance attached to this {@code SwingNode}.
          * <p>
          * The method can be called either on the JavaFX Application thread or the Swing thread.
          * Note however, that access to a Swing component must occur from the Swing thread according
          * to the Swing threading restrictions.
          *
          * @see java.awt.EventQueue#isDispatchThread()
          * @see javafx.application.Platform#isFxApplicationThread()
          *
          * @return the Swing component attached to this {@code SwingNode}
          */
         public JComponent getContent();
      }

            ant Anton Tarasov (Inactive)
            ant Anton Tarasov (Inactive)
            Votes:
            4 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: