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

JavaFX DatePicker fails when embedded into JFXPanel into SwingNode

XMLWordPrintable

    • x86_64
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      Windows 10
      Oracle JDK 8 update 192 and OpenJDK 11.0.1 with OpenJFX 11.0.1 jlinked in it

      A DESCRIPTION OF THE PROBLEM :
      The DatePicker closes with no action when picking a day or when clicking on a previous or next button for month/year.
      This happens on Oracle JDK 8 update 192 and OpenJDK 11.0.1 with OpenJFX 11.0.1 jlinked in it

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the given code, open the popup, click on a day / button

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      popup closes and the date is set / month or year changes to previous / next and popup stays open
      ACTUAL -
      popup closes, no date set

      ---------- BEGIN SOURCE ----------
      package test.mavenproject8;

      import java.awt.BorderLayout;
      import javafx.application.Application;
      import javafx.embed.swing.JFXPanel;
      import javafx.embed.swing.SwingNode;
      import javafx.scene.Scene;
      import javafx.scene.control.DatePicker;
      import javafx.scene.layout.BorderPane;
      import javafx.stage.Stage;
      import javax.swing.JPanel;

      public class JavaFXApplication9 extends Application
      {
        
        @Override
        public void start(Stage stage) throws Exception
        {
          stage.setScene(getMainJavaFxScene());
          stage.show();
        }
        
        private static Scene getMainJavaFxScene()
        {
          BorderPane root = new BorderPane();
          SwingNode node = new SwingNode();
          root.setCenter(node);
          node.setContent(createIntermediateSwingLayer());
          return new Scene(root);
        }
        
        private static JPanel createIntermediateSwingLayer()
        {
          JPanel jpanel = new JPanel();
          jpanel.setLayout(new BorderLayout());
          jpanel.add(createJFXPanel(), BorderLayout.CENTER);
          return jpanel;
        }
        
        private static JFXPanel createJFXPanel()
        {
          JFXPanel jfxPanel = new JFXPanel();
          Scene jfxPanelScene = new Scene(createInnerJavaFxScene());
          jfxPanel.setScene(jfxPanelScene);
          return jfxPanel;
        }
        
        private static BorderPane createInnerJavaFxScene()
        {
          BorderPane jfxPanelBorderPane = new BorderPane();
          DatePicker datePicker = new DatePicker();
          jfxPanelBorderPane.setCenter(datePicker);
          return jfxPanelBorderPane;
        }

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

      ---------- END SOURCE ----------

      FREQUENCY : always


            psadhukhan Prasanta Sadhukhan
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: