JDK-4139692 : JOptionPane.showInternalMessageDialog() does not create a modal dialog
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version:
    4.1,bdk_1.0,1.1,1.1.6,1.2.0,1.3.0,1.3.1 4.1,bdk_1.0,1.1,1.1.6,1.2.0,1.3.0,1.3.1
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS:
    generic,solaris_2.5.1,solaris_2.6,windows_95,windows_nt generic,solaris_2.5.1,solaris_2.6,windows_95,windows_nt
  • CPU: generic,x86,sparc
  • Submitted: 1998-05-18
  • Updated: 2003-11-03
  • Resolved: 2003-11-03
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
5.0 b28Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description

Name: rk38400			Date: 05/18/98


Using the code given below, bring up the internal
message dialog. Click on the JTextField & focus is
moved there. Worse if you bring up the 
JOptionPane.showMessageDialog() before dismissing
the internal dialog you are totally locked up.

import java.awt.*;
import java.awt.event.*;
import com.sun.java.swing.*;

class TestFrame extends JFrame {
  TestFrame()  {
    getContentPane().setLayout(new FlowLayout());

    JButton dlgErrBtn = new JButton("Dialog error msg");
    dlgErrBtn.addActionListener(new DlgErrBtnController());
    getContentPane().add(dlgErrBtn);

    getContentPane().add(new JTextField("hello world")); 

    JButton dlgInErrBtn = new JButton("Internal Dialog error msg");
    dlgInErrBtn.addActionListener(new DlgInErrBtnController());
    getContentPane().add(dlgInErrBtn);
    
    addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e) {
        System.exit(0);                                                
      }                                       
    });                 
    
    Msg.setParent(this);
  }

  class DlgErrBtnController extends AbstractAction {
    public void actionPerformed(ActionEvent evt) {
      Msg.err("Hello World\nWe have bugs\n");
    }
  }

  class DlgInErrBtnController extends AbstractAction {
    public void actionPerformed(ActionEvent evt) {
      Msg.errIn("Hello World\nWe have bugs\n");
    }
  }
}                 

class Msg {     
  public static void err(String s) {
    if (frame == null)
      System.out.println(s);
    else
      JOptionPane.showMessageDialog(frame.getContentPane(),s,"Standard Dialog",JOptionPane.INFORMATION_MESSAGE);
  }
  public static void errIn(String s) {
    if (frame == null)
      System.out.println(s);
    else
      JOptionPane.showInternalMessageDialog(frame.getContentPane(),s,"Internal Message Dialog",JOptionPane.INFORMATION_MESSAGE);
  }
  
  public static void setParent(JFrame f) {
    frame = f;
  }
  private static JFrame frame;
}

public class TestApp {
  TestApp() throws Exception {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    frame = new TestFrame();
    frame.setSize(400,300);
    frame.setVisible(true);
  }

  public static void main(String[] argv) {
    try {
       new TestApp();
    }
    catch(Exception e) {
      System.out.println(e);
      e.printStackTrace();
    }
  }

  TestFrame frame;
}
(Review ID: 30613)
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger-beta FIXED IN: tiger-beta INTEGRATED IN: tiger-b28 tiger-beta
14-06-2004

EVALUATION In the current Swing release, there are exceptions generated when running this test case. (And yet the test case continues to run, and demonstrate the described bug.) I would guess that the exceptions that are occuring point to the basic cause of the problem. john.pampuch@Eng 1998-05-27 Running with 1.3 I'm not seeing anything lock up, but indeed the internal message dialog is not modal. To implement the jinternalframe modality properly, we'd really need modal support from the JDesktopPane/JInternalFrame infrastructure. Maybe we'd even like to add a JInternalDialog subclass which supported the modality to keep the api orthagonal to the JFrame/JDialog api. ?? amy.fowler@Eng 2000-02-16 amy.fowler@Eng 2000-02-16 -------------------------------------------------------------------------------- You may close out this bug as fixed and integrated because I ran the demo program in the X-description and it ran OK with the Kestrel courtesy release and Tweety. It threw lots of exception in jdk1.2 but that's no longer the case. Roger Pham 4/17/2000 This is still an issue in 1.4. Looking into what's required to implement this. ###@###.### 2002-02-08
08-02-2002