Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4636311

Hang in JDK1.4 rc when showing a modal dialog from a Runnable

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.2
    • 1.4.0
    • client-libs
    • None
    • mantis
    • generic
    • generic

      I filed this bug based on an email I received about feedback on JDK1.4 RC.

      I filed the platform as generic because that information was not given.

      There's another problem I've been having w/ modal dialogs that appears
      in JDK1.3.1 & JDK1.4-rc1, but does not appear JDK1.3.0 and did not
      appear in JDK1.4-beta3. Basically the modal dialog comes up, but all of
      the components within the dialog are not useable (it's like there's a
      glass pane that covers the dialog making the components unusable), only
      the dialog close box takes events.

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


      public class DialogBug extends JFrame implements ActionListener {

          private DialogBug bug;

          public DialogBug() {
              super("Frame");
              bug this;
              getContentPane().setLayout(new FlowLayout());
              JButton b new JButton("Press Me");
              b.addActionListener(this);
              getContentPane().add(b);
              Dimension d Toolkit.getDefaultToolkit().getScreenSize();
              setBounds(d.width/2-120, d.height/2-160, 200, 200);
              addWindowListener(new WindowAdapter() {
                                    public void windowClosing(WindowEvent e) {
                                        System.exit(0);
                                    }
                                });
              setVisible(true);
          }

          public void actionPerformed(ActionEvent e) {
              new MyDialog();
          }


          public class MyDialog extends JDialog implements ActionListener {

              public MyDialog() {
                  super(bug, "Modal Dialog", true);
                  getContentPane().setLayout(new FlowLayout());
                  JButton b new JButton("Threaded");
                  b.addActionListener(this);
                  getContentPane().add(b);
                  b new JButton("Not Threaded");
                  b.addActionListener(this);
                  getContentPane().add(b);
                  Rectangle r bug.getBounds();
                  setBounds(r.x, r.y, 200, 200);
                  setVisible(true);
              }

              public void actionPerformed(ActionEvent e) {
                  String command e.getActionCommand();
                  if (command.equals("Threaded")) {
                      //
                      // The problem appears when threaded otherwise ok...
                      //
                      Runnable runner new Runnable() {
                          public void run() {
                              JOptionPane.showMessageDialog(null, "Try to press OK button!!!");
                          }
                      };
                      new Thread(runner).start();
                  } else {
                      JOptionPane.showMessageDialog(null, "Try to press OK button!!!");
                  }
              }
          }


          public static void main(String args[]) {
              new DialogBug();
          }
      }

            son Oleg Sukhodolsky (Inactive)
            ehawkessunw Eric Hawkes (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: