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

[macos] JComboBox doesn't display popup in mixed JavaFX Swing Application on 8u131 and Mac OS 10.12

XMLWordPrintable

    • b03
    • b172
    • x86
    • os_x

        FULL PRODUCT VERSION :
        java version "1.8.0_131"
        Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
        Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        OSX 10.12 Sierra

        A DESCRIPTION OF THE PROBLEM :
        In a mixed JavaFx Swing Application with java version "1.8.0_131", JComboBox doesn't display popup
        (see example code). This happens only on Apple OSX 10.12 Sierra. The program works well on Windows 10 and Linux Debian.

        REGRESSION. Last worked in version 8u121

        ADDITIONAL REGRESSION INFORMATION:
        java version "1.8.0_131"
        Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
        Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Start this and try to select the JComboBox
        The popup doesn't appear

        public class TestGuiSwing extends Application{


        @Override
        public void start(Stage primaryStage) throws Exception {

        final SwingNode swingNode = new SwingNode();
                    createSwingContent(swingNode);

                   Pane pane = new Pane();
                   pane.getChildren().add(swingNode);

                   primaryStage.setTitle("Swing in JavaFX");
                   primaryStage.setScene(new Scene(pane, 500, 500));
                   primaryStage.show();
            }

        private void createSwingContent(final SwingNode swingNode) {

        SwingUtilities.invokeLater(() -> {

        JComboBox<String> cb = new JComboBox<String>();


        cb.addItem("item 1");
        cb.addItem("item 2");
        cb.addItem("item 3");
        cb.addItem("item 4");

                              JPanel jPanel = new JPanel();
                              jPanel.add(cb);
                    
                         swingNode.setContent(jPanel);

               

        });

        }
        }


        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        If you select the JComboBox
        the popup appears

        ACTUAL -
        If you select the JComboBox
        the popup doesn't appear


        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        No error

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        public class TestGuiSwing extends Application{


        @Override
        public void start(Stage primaryStage) throws Exception {

        final SwingNode swingNode = new SwingNode();
                    createSwingContent(swingNode);

                   Pane pane = new Pane();
                   pane.getChildren().add(swingNode);

                   primaryStage.setTitle("Swing in JavaFX");
                   primaryStage.setScene(new Scene(pane, 500, 500));
                   primaryStage.show();
            }

        private void createSwingContent(final SwingNode swingNode) {

        SwingUtilities.invokeLater(() -> {

        JComboBox<String> cb = new JComboBox<String>();


        cb.addItem("item 1");
        cb.addItem("item 2");
        cb.addItem("item 3");
        cb.addItem("item 4");

                              JPanel jPanel = new JPanel();
                              jPanel.add(cb);
                    
                         swingNode.setContent(jPanel);

               

        });

        }
        }

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

        CUSTOMER SUBMITTED WORKAROUND :
        no workaround

              azvegint Alexander Zvegintsev
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Created:
                Updated:
                Resolved: