JDK-4851685 : Component.requestFocus() fails on Solaris and Linux
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 5.0u7,6
  • Priority: P3
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS:
    generic,solaris_8,solaris_9,solaris_10 generic,solaris_8,solaris_9,solaris_10
  • CPU: generic,x86,sparc
  • Submitted: 2003-04-22
  • Updated: 2012-10-01
  • Resolved: 2007-10-30
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Bug #4199374 was report against Win32 platforms and CTE engineer fixed ONLY on Win32 platforms. The problem is still reproducable in Linux and Solaris platforms. 

It failing on 1.3.1.xx, 1.4.1.xx, 1.4.2.xx, 1.5.0.

Need to be fixed ASAP

Name: rpR10076			Date: 12/03/2003

Component.requestFocus() fails on Solaris

Name: rpR10076			Date: 12/03/2003

Component.requestFocus() fails on Solaris


EVALUATION I think, we're free to close it now. MToolkit has gone.

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang

EVALUATION Name: osR10079 Date: 04/22/2003 The problem is reproducible on 1.3.1, 1.4, 1.4.1 and 1.4.2 Thus this is not a mantis or hopper regression. ###@###.### 2003-04-23 ====================================================================== Name: rpR10076 Date: 12/03/2003 First of all, the test for 4199374 in the exact from won't work with any JDK starting with 1.4.0. In that test, a component (JTextField) is inserted into a Window which has no visible owner. According to 1.4 focus spec, such a Window cannot receive focus. The test needs to be changed so that JFrame becomes JWindow's owner. In that form, the problem, indeed, exists on Solaris and Linux. However, on Linux this behaviour was fixed around 1.5.0 b15, at least the test works fine on Linux with current builds (b29). This is related to XAWT work, which, among other things, took care of this problem. On Solaris, we can't fix it in tiger and will request this bug to be WAIVED. Once the XAWT toolkit becomes default on Solaris (we expect this to happen in JDK 1.5.1), the problem will be fixed on Solaris, too. Below is the corrected test case: === import java.awt.event.*; import javax.swing.*; public class Test { public static void main(String args[]) { final JFrame frame = new JFrame(); JButton button = new JButton("Test"); frame.getContentPane().add(button); frame.pack(); frame.addFocusListener(new NoisyFocusListener("Frame")); button.addFocusListener(new NoisyFocusListener("Button")); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JWindow window = new JWindow(frame); // JFrame window = new JFrame(); JTextField field = new JTextField("Edit Me!"); window.getContentPane().add(field); window.pack(); field.addFocusListener(new NoisyFocusListener("Field")); window.addFocusListener(new NoisyFocusListener("Window")); window.setVisible(true); field.requestFocus(); } }); frame.setVisible(true); } static class NoisyFocusListener implements FocusListener { private String name; public NoisyFocusListener(String name) { this.name = name; } public void focusGained(FocusEvent e) { System.out.println(name + (e.isTemporary() ? " got temporary focus." : " got focus.")); } public void focusLost(FocusEvent e) { System.out.println(name + (e.isTemporary() ? " lost temporary focus." : " lost focus.")); } } } === ###@###.### ====================================================================== We discussed this at the Tiger core team meeting today. The general feeling was that we ought to try to fix the bug, but not in the Tiger timeframe. I'll commit this to Mustang. Since the customer was primarily concerned about Windows, I don't see this as a regression as long as the test continues to pass on Windows. Also, the test should be updated as suggested above. ###@###.### 2003-12-03