JDK-8032872 : [macosx] Cannot select from JComboBox in a JWindow
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 7u17,8,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • Submitted: 2014-01-28
  • Updated: 2014-10-15
  • Resolved: 2014-03-06
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 7 JDK 8 JDK 9
7u72Fixed 8u20Fixed 9 b08Fixed
Related Reports
Duplicate :  
Duplicate :  
Description

Issue with Java version 7u17 / Mac only.

Add a JComboBox to a JWindow. Show the window from a parent frame. The combo 
can be opened, but it does not allow selection from the mouse. The popup 
closes on mousePressed, but no selection is made. On other OSes and on Java 
1.6 the item is selected correctly on mouseReleased.

Test case:
import java.awt.FlowLayout;

import java.awt.Point;
import java.awt.Window;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JWindow;
import javax.swing.SwingUtilities;

public class TestClass {
    public static void main(String[] args) {
        JFrame f = new JFrame();
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setSize(300, 200);
        f.setLocationRelativeTo(null);

        f.setLayout(new FlowLayout());
        
        final JButton popButton = new JButton("Press me");
        popButton.addActionListener(new AbstractAction() {

            @Override
            public void actionPerformed(ActionEvent e) {
                Window parentWin =
SwingUtilities.windowForComponent(popButton);
                JWindow popup = new JWindow(parentWin);
                
                JPanel panel = new JPanel(new FlowLayout());
                panel.add(new JLabel("Cannot Select with Mouse:"));
                panel.add(new JComboBox(new String[] { "One", "Two", "Three"
}));
                popup.add(panel);
                Point p = popButton.getLocationOnScreen();
                popup.add(panel);
                popup.pack();
                popup.setLocation(p.x, p.y + popButton.getHeight());
                popup.setVisible(true);
            }
        });

        f.add(popButton);
        f.setVisible(true);
    }
} 


Comments
SQE is ok to take the fix in PSU14_04.
29-05-2014

This is pretty old issue. What is a justification to have it in CPU14_03 after RDP2 phase?
18-04-2014

8-defer-request: P3 functional bug, isn't regression, isn't P1, isn't tck-red
03-03-2014

Problem description: It is impossible to make a selection in JComboBox added to JWindow via the mouse. The problem is caused by incorrect mouse events handling in LWWindowPeer class. When LWWindowPeer receives a mouse event intended for a popup window, it checks whether the current grabbingWindow is owner of the popup using getOwnerFrameDialog() method. This approach always fails for the JComboBox added to JWindow. As a result an UngrabEvent is send to the popup window. Fix: Introduce new private method LWWindowPeer.isOneOfOwnersOf(LWWindowPeer peer). The method will be invoked on grabbingWindow object to test whether it is owner of current mouse event target or not. The usage of getOwnerFrameDialog() should be replaced by isOneOfOwnersOf() in LWWindowPeer.notifyMouseEvent() and LWWindowPeer.NotifyNCMouseDown().
03-03-2014