JDK-4381959 : Focus not handled correctly after two consecutive dialogs
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_nt
  • CPU: x86
  • Submitted: 2000-10-23
  • Updated: 2000-12-26
  • Resolved: 2000-12-26
Related Reports
Duplicate :  
Description

Name: skT45625			Date: 10/23/2000


java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

If more than one dialog is displayed during focusLost processing, it will no
longer be possible to set focus to the JComponent. This problem occurs under NT
4.0 and Win2000. It behaves correctly under Win95. The following code
demonstrates the problem.

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.lang.*;

class DlgTest extends JFrame {
  public static void main(String argv[]) {
    new DlgTest().addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent ev) {
        System.exit(0);
      }
    });
  }

  public DlgTest() {
    super("Test Frame");
    setSize(350,100);
    Panel	p = new Panel();
    p.setLayout(new FlowLayout());
    setContentPane(p);

    JTextField fld1 = new JTextField("field 1", 20);
    JTextField fld2 = new JTextField("field 2", 20);

    fld1.addFocusListener(new FocusProcessor(this));

    p.add(fld1);
    p.add(fld2);

    setVisible(true);
  }

  class FocusProcessor implements FocusListener {
    JFrame		frame;

    public FocusProcessor(JFrame frame) {
      this.frame = frame;
    }

    public void focusGained(FocusEvent e) {
    }

    public void focusLost(FocusEvent e) {
      if (! e.isTemporary()) {
        JOptionPane.showMessageDialog(frame, "message 1");
        JOptionPane.showMessageDialog(frame, "message 2");
      }
    }
  }
}

This will create a frame containing two text fields. Tab out of field 1. Two
message dialogs will appear. After closing the dialogs, a cursor is still
visible in field 1 even though field 2 has focus. It is not possible to set
focus back to field 1.
(Review ID: 111252) 
======================================================================

Comments
EVALUATION Name: pzR10082 Date: 12/26/2000 This is not reproducible after focus changes. ###@###.### 2000-12-26 ======================================================================
26-12-2000