JDK-4681908 : REGRESSION: model Dialog can not be displayed from within a FocusGained Event
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_8
  • CPU: sparc
  • Submitted: 2002-05-08
  • Updated: 2002-08-22
  • Resolved: 2002-08-22
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.2 mantisFixed
Related Reports
Relates :  
Description

Name: gm110360			Date: 05/08/2002


FULL PRODUCT VERSION :
java version "1.4.0"
Java (TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

or



FULL OPERATING SYSTEM VERSION :
SunOS expenses 5.8 Generic_108528-14 sun4u sparc
SUNW,Ultra-Enterprise

ADDITIONAL OPERATING SYSTEMS :
Windows 2000 Pro.



EXTRA RELEVANT SYSTEM CONFIGURATION :
None
This problem only occurs in Java 1.4 not in earlier releases

A DESCRIPTION OF THE PROBLEM :
The issue is that when you have a java.awt.TextField that
has a FocusListener.  When the Focus is GAINED the
application attempt to display a Modal Dialog.  The Modal
Dialog causes the application to freeze.

REGRESSION.  Last worked in version 1.3.1

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1.  compile classes
2.  execute myFrame
3.  click into the textfield

EXPECTED VERSUS ACTUAL BEHAVIOR :
The expected result would be an dialog box would appear.
Inside of the dialog box is a button. You should be able to
click the button.

The actual result is that the dialog box appears but the
application is HUNG.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
no error messages

This bug can be reproduced always.

---------- BEGIN SOURCE ----------
public class myFrame extends java.awt.Frame {

    /** Creates new form myFrame */
    public myFrame() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    private void initComponents() {
        textField1 = new java.awt.TextField();
        
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                exitForm(evt);
            }
        });
        
        textField1.setText("textField1");
        textField1.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                myHandler(evt);
            }
        });
        
        add(textField1, java.awt.BorderLayout.CENTER);
        
        pack();
    }

    private void myHandler(java.awt.event.FocusEvent evt) {
        // Add your handling code here:
        System.out.println(evt);
 
                new myDialog(this, true).setVisible(true);
        
        
    }

    /** Exit the Application */
    private void exitForm(java.awt.event.WindowEvent evt) {
        System.exit(0);
    }

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        new myFrame().show();
    }


    // Variables declaration - do not modify
    private java.awt.TextField textField1;
    // End of variables declaration

}

public class myDialog extends java.awt.Dialog {

    /** Creates new form myDialog */
    public myDialog(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    private void initComponents() {
        button1 = new java.awt.Button();
        
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                closeDialog(evt);
            }
        });
        
        button1.setLabel("myBigButton");
        add(button1, java.awt.BorderLayout.CENTER);
        
        pack();
    }

    /** Closes the dialog */
    private void closeDialog(java.awt.event.WindowEvent evt) {
        setVisible(false);
        dispose();
    }

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        new myDialog(new java.awt.Frame(), true).show();
    }


    // Variables declaration - do not modify
    private java.awt.Button button1;
    // End of variables declaration

}
---------- END SOURCE ----------

CUSTOMER WORKAROUND :
I have not found a work around

Release Regression From : 1.3.1_03
The above release value was the last known release where this 
bug was known to work. Since then there has been a regression.

(Review ID: 146337) 
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mantis FIXED IN: mantis INTEGRATED IN: mantis
24-08-2004

EVALUATION Name: osR10079 Date: 08/02/2002 The problem is the same as 4531693 ======================================================================
24-08-2004