JDK-4851685 : Component.requestFocus() fails on Solaris and Linux
  • Type: Bug
  • Status: Closed
  • Resolution: Cannot Reproduce
  • Component: client-libs
  • Sub-Component: java.awt
  • Priority: P3
  • Affected Version: 5.0u7,6
  • OS: generic,solaris_8,solaris_9,solaris_10
  • CPU: generic,x86,sparc
  • Submit Date: 2003-04-22
  • Updated Date: 2012-10-01
  • Resolved Date: 2007-10-30
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description
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


======================================================================

Comments
EVALUATION I think, we're free to close it now. MToolkit has gone.
2007-10-30

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang
2004-09-22

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
2003-12-03