JDK-6246456 : Disabling focus traversal keys not working properly for JComboBox in editable mode
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2005-03-26
  • Updated: 2017-05-23
Related Reports
Relates :  
Relates :  
Description
I am calling setFocusTraversalKeysEnabled(false) for a JComboBox that is editable. I expect the component to ignore the focus traversal keys such as TAB, CTRL+TAB, etc and no focus traversal operation must be initiated. These keys must be processed by the component in the same way as any other keys. But JComboBox initiates a focus traversal operation in spite of calling the above method. On Pressing TAB, focus shifts to the next component. 

This happens on all platforms atleast since 1.4. Reproducible on the latest mustang build (b28). This is reproducible only when JcomboBox is editable. Works fine in non-editable mode. 

I have attached a sample test. Execute the sample test. You would see a frame with 3 components. Make sure JComboBox has the focus. Press 'TAB' or CTRL + TAB. If the focus shifts to the next component (JList), the bug is reproduced.
###@###.### 2005-03-26 13:04:59 GMT

Comments
EVALUATION JComboBox is a composite component. To accomplish what you want when editable, you need to disable the focus traversal keys on the editor component: comboBox.getEditor().getEditorComponent().setFocusTraversalKeysEnabled(false); ###@###.### 2005-03-30 20:56:14 GMT Closing as a duplicate of 4144505. ###@###.### 2005-03-30 21:05:05 GMT It's been brought to my attention that we recently made a change to propogate a component's "focusable" state to the child components (6184449). In this light, it's worth some further investigation to decide whether or not it's worth propogating disabling of the focus traversal keys. We need to weigh this carefully as we could quickly slide down the slope of propogating *every* property to child components. And we don't want to do head down that path. Reopening the bug, but downgrading the priority. ###@###.### 2005-04-06 18:20:08 GMT See 4144505 for an example of how we've been careful about fixing these issues in the past. ###@###.### 2005-04-06 18:33:18 GMT
30-03-2005