United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-4632782 Need to provide way to disable PopupMenus from taking focus
JDK-4632782 : Need to provide way to disable PopupMenus from taking focus

Details
Type:
Enhancement
Submit Date:
2002-02-04
Status:
Closed
Updated Date:
2002-06-16
Project Name:
JDK
Resolved Date:
2002-03-09
Component:
client-libs
OS:
windows_nt,solaris_7
Sub-Component:
javax.swing
CPU:
x86,sparc
Priority:
P3
Resolution:
Fixed
Affected Versions:
1.4.0
Fixed Versions:
1.4.1 (hopper)

Related Reports
Duplicate:

Sub Tasks

Description
In 1.4 showing a JPopupMenu now moves focus. This is so that keybindings work. This is good. But some components, like JComboBox, handle their own keybindings and do not want JPopupMenu stealing focus. While we have special cased JComboBox, we need a general solutions for developers that are bumping into this.

                                    

Comments
SUGGESTED FIX



Name: pzR10082			Date: 02/05/2002



------- BasicPopupMenuUI.java -------
*** /tmp/sccs.gCa4Vd	Tue Feb  5 16:20:18 2002
--- BasicPopupMenuUI.java	Tue Feb  5 16:17:17 2002
***************
*** 54,60 ****
  	    popupMenu.getLayout() instanceof UIResource)
  	    popupMenu.setLayout(new DefaultMenuLayout(popupMenu, BoxLayout.Y_AXIS));
  
- 	popupMenu.setFocusable(false);
  	popupMenu.setOpaque(true);
  	LookAndFeel.installBorder(popupMenu, "PopupMenu.border");
  	LookAndFeel.installColorsAndFont(popupMenu,
--- 54,59 ----
***************
*** 837,845 ****
  	    MenuSelectionManager msm = (MenuSelectionManager)ev.getSource();
  	    MenuElement[] p = msm.getSelectedPath();
              JPopupMenu popup = getActivePopup(p);
!             if (popup != null && popup instanceof BasicComboPopup) {
!                 // Combo popups don't transfer focus anywhere, so we do
!                 // nothing special.
                  return;
              }
  
--- 836,843 ----
  	    MenuSelectionManager msm = (MenuSelectionManager)ev.getSource();
  	    MenuElement[] p = msm.getSelectedPath();
              JPopupMenu popup = getActivePopup(p);
!             if (popup != null && !popup.isFocusable()) {
!                 // Do nothing for non-focusable popups
                  return;
              }
  

###@###.### 2002-02-05

======================================================================
                                     
2002-02-05
EVALUATION



Name: pzR10082			Date: 02/05/2002


It appears we can safely use the focusable property of the popup
menu. This means, if a popup is not focusable, we will not move focus
anywhere when it shows up. For a developer it is sufficient to make
their popups non-focusable.

###@###.### 2002-02-05

======================================================================
                                     
2002-02-05
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
hopper

FIXED IN:
hopper

INTEGRATED IN:
hopper

VERIFIED IN:
hopper-beta


                                     
2004-08-24



Hardware and Software, Engineered to Work Together