JDK-8178996 : [macos] JComboBox doesn't display popup in mixed JavaFX Swing Application on 8u131 and Mac OS 10.12
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 8u131,9
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • CPU: x86
  • Submitted: 2017-04-19
  • Updated: 2017-11-29
  • Resolved: 2017-05-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 10 JDK 8 JDK 9 Other
10Fixed 8u141Fixed 9 b172Fixed openjdk7uFixed
Description
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


Comments
Fix Request: These changes are necessary to fix the regression caused JDK-8165626. Without it popup menus will remain broken in mixed Swing/Java FX applications.
11-05-2017

9-ea+167 : Fail So, removing '9-na' label.
02-05-2017

8u131/CPU bug fixes were probably not present in 9 b166. Issue may manifest in 9-ea b167 when 8u131 CPU bugs were synced into 9.
21-04-2017

Issue is reproducible in OSX only with java version 1.8.0_131b11 8u121 : Pass 8u131b11 : Fail 9-ea+166 : Pass Not reproducible in windows and Linux. PFA test case "TestGuiSwing.java"
21-04-2017

Yes, we should retest with 9+167 to see if this is the case.
21-04-2017

Possibly related to "Introduced a new window ordering model"? http://www.oracle.com/technetwork/java/javase/8u131-relnotes-3565278.html
20-04-2017

This is almost certainly a Swing bug rather than a JavaFX bug. All but one of the changes in JavaFX in 8u131 were in WebView, and that one change was in platform-specific code in the Windows platform to send a missing event when a window is maximized. So there have been no changes in JavaFX that could account for this.
20-04-2017