JDK-4632782 : Need to provide way to disable PopupMenus from taking focus
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.0
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_7,windows_nt
  • CPU: x86,sparc
  • Submitted: 2002-02-04
  • Updated: 2022-04-27
  • Resolved: 2002-03-09
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.
Other
1.4.1 hopperFixed
Related Reports
Duplicate :  
Relates :  
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
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: hopper FIXED IN: hopper INTEGRATED IN: hopper VERIFIED IN: hopper-beta
24-08-2004

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 ======================================================================
05-02-2002

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 ======================================================================
05-02-2002