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

Modal dialogs do not behave as documented even in separate AppContexts

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 1.3.0
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description



      Name: krT82822 Date: 03/02/2000


      2 Mar 2000, eval1127@eng -- please see Comments section.

      java version "1.2.2" (and kestrel-rc1)
      HotSpot VM (1.0.1, mixed mode, build g)

      The JDK1.2 javadoc says
      <quote>
      A modal dialog is one which blocks input to all other toplevel
      windows in the app context, except for any windows created
      with the dialog as their owner.
      </quote>

      I figured out how to create a separate AppContext. It still
      does not work correctly.

      Here is the test case


      /**
       * MTGDialogTest.java
       *
       *
       * Created: Thu Feb 18 15:55:03 1999
       *
       * @author Sandip Chitale
       * @version
       */
      import sun.awt.*;
      import java.awt.*;
      import java.awt.event.*;



      public class MTGDialogTest extends Frame {

          private Dialog jd;

          private static int i = 0;
          private static int count = 0;
          
          public MTGDialogTest() {
              i++;
              setTitle(MTGDialogTest.class.getName() + "-" + i);

              jd = new Dialog(this, "JDialog" + "-" + i , true);
      jd.setResizable(false);
              jd.addWindowListener(new WindowAdapter() {
      public void windowActivated(WindowEvent e) {}
      public void windowClosed(WindowEvent e) {}
      public void windowClosing(WindowEvent e)
      {jd.setVisible(false);}
      public void windowDeactivated(WindowEvent e) {}
      public void windowDeiconified(WindowEvent e) {}
      public void windowIconified(WindowEvent e) {}
      public void windowOpened(WindowEvent e) {}});
              
              jd.setSize(200,200);
              
              Button b = new Button("Show dialog");
              b.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
      jd.show();
      }});
              
              add(b, BorderLayout.CENTER);
              setBounds(count*50, count*50, 300,300);
      count++;


      addWindowListener(new WindowAdapter() {
      public void windowActivated(WindowEvent e) {}
      public void windowClosed(WindowEvent e) {}
      public void windowClosing(WindowEvent e)
      {System.exit(0);}

      public void windowDeactivated(WindowEvent e) {}
      public void windowDeiconified(WindowEvent e) {}
      public void windowIconified(WindowEvent e) {}
      public void windowOpened(WindowEvent e) {}});
      System.out.println("----");
      System.out.println(AppContext.getAppContext());

      System.out.println(Toolkit.getDefaultToolkit().getSystemEventQueue());

          }

          public static void main(String args[])
          {
      ThreadGroup tg = null;

      Thread t = null;

      for (int i = 0; i < 4; i++) {
      tg = new ThreadGroup("sandip" + i);
      t = new Thread(tg,
      new Runnable() {
      public void
      run()
      {
      //
      Comment the following to have shared AppContext vs separate AppContext per
      //
      threadgroup

      SunToolkit.createNewAppContext();
      new
      MTGDialogTest().setVisible(true);
      }
      }
      );
      t.start();
      }
          }
          
      } // MTGDialogTest
      (Review ID: 101999)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dmendenhsunw David Mendenhall (Inactive)
                Reporter:
                kryansunw Kevin Ryan (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: