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

Unable to use modal dialogs when something locks Component.LOCK

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.0.2, 1.1, 1.1.4, 1.1.5
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • CPU:
      generic, x86, sparc
    • OS:
      generic, solaris_2.4, windows_95, windows_nt

      Description



      Name: mc57594 Date: 02/26/97


      During the time when something has synchronized on
      Component.LOCK, modal dialogs belonging to that hierarchy
      will no longer get events, and often will not paint properly

      Try the following code, first click the No Lock button,
      then the With Lock button. The dialog that pops
      up with the With Lock button looks okay, but no events are
      comming from the button, so the dialog won't go away and the
      application is locked up.

      Code follows:
      import java.awt.*;
      import java.awt.event.*;

      class MyDialog extends Dialog implements ActionListener, Runnable {

      Button b;

      public MyDialog(Frame f) {
              super(f,"MyDialog",true);
              b = new Button("Me");
              b.addActionListener(this);
              Label l = new Label("Push 'Me' to exit");
              add("Center",l);
              add("South",b);
              pack();
      }

      public void actionPerformed(ActionEvent e) {
              setVisible(false);
      }
      }

      public class test2 extends Frame implements ActionListener {

      Button b1;
      Button b2;

      public static void main(String argv[]) {
              test2 t = new test2();
              t.show();
      }

      public test2() {
              b1 = new Button("No lock");
              b2 = new Button("With lock");
              add("North",b1);
              add("South",b2);
              b1.addActionListener(this);
              b2.addActionListener(this);
      }

      public void actionPerformed(ActionEvent e) {
              MyDialog md;
              Object o;
              if (e.getSource() == b1) {
                      //No lock...
                      md = new MyDialog(this);
                      md.show();
              } else {
                      //Use lock
                      o = getTreeLock();
                      synchronized (o) {
                              md = new MyDialog(this);
                              md.show();
                      }
              }
      }
      }

      company - A.I. Soft Inc. , email - ###@###.###
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mmartaksunw Michael Martak (Inactive)
                Reporter:
                mchamnessunw Mark Chamness (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: