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

Modal dialogs open slowly with JRE 1.6.0 sun.awt.X11.XToolkit

XMLWordPrintable

    • b14
    • x86, sparc
    • linux, solaris, solaris_7, solaris_10
    • Verified

        A DESCRIPTION OF THE REQUEST :
        With JRE 1.6.0 on Sparc Solaris 10 and the default awt.toolkit (sun.awt.X11.XToolkit),
        it takes several seconds for a modal dialog (javax.swing.JDialog) to appear. The
        application appears frozen during this pause.
        Switching to the old motif toolkit restores the expected behavior of no pause before
        modal dialogs appear.

        JUSTIFICATION :
        By default on JRE 1.6.0 sparc solaris, there is a several second freeze any time a modal
        dialog (including JFileChooser) is opened.
        JRE 1.5.0 did not exhibit this freeze behavior with either sun.awt.X11.XToolkit or
        sun.awt.motif.MToolkit.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        There should be no noticable pause when opening a modal dialog.
        ACTUAL -
        The application freezes for several seconds before the modal dialog appears.

        ---------- BEGIN SOURCE ----------
        class TestAModalDialog extends javax.swing.JDialog
            implements java.awt.event.ActionListener {
            public TestAModalDialog(java.awt.Frame parent) {
                super(parent, true);
                javax.swing.JButton b = new javax.swing.JButton("Dismiss");
                getContentPane().add(b);
                b.addActionListener(this);
                pack();
                setLocation(parent.getLocation());
            }
            public void actionPerformed(java.awt.event.ActionEvent e) {
               setVisible(false);
               dispose();
            }
        }

        class TestA extends javax.swing.JFrame
            implements java.awt.event.ActionListener {
            public TestA() {
                javax.swing.JButton b = new javax.swing.JButton("Press Me");
                getContentPane().add(b);
                b.addActionListener(this);
                pack();
                addWindowListener(new java.awt.event.WindowAdapter() {
                    public void windowClosing(java.awt.event.WindowEvent evt) {
                        System.exit(0);
                    }
                });
                setLocation(new java.awt.Point(x,y));
                x+=100; y+=50;
            }
            public void actionPerformed(java.awt.event.ActionEvent e) {
                new TestAModalDialog(this).setVisible(true);
            }
            static int x = 0;
            static int y = 0;
            public static void main(String[] argv) {
               // put up three JFrames
               new TestA().setVisible(true);
               new TestA().setVisible(true);
               new TestA().setVisible(true);
            }
        }
        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        switch to the motif toolkit by setting -Dawt.toolkit=sun.awt.motif.MToolkit when running java 1.6.0 on sparc solaris.

              art Artem Ananiev (Inactive)
              dav Andrei Dmitriev (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: