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

MToolkit : closing a Modal dialog keeps top-level window uneditable

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P2 P2
    • 6-pool
    • 6u21-rev
    • client-libs
    • sparc
    • solaris_10

      Compile and execute the following testcase with MToolkit.

      1- Type test in the 2 TextFields of the top window
      2- Click on the "Open JDialog" button
      3- Close the "Modal JDialog" window
      4- Try to type text in the 2 TextFields. The 2 TextFields are no more editable.

      In addition, when the Modal window is opened, the mouse cursor is a text cursor in the TextFields instead of an arrow as in XToolkit.

      % cat Test.java
      import javax.swing.*;
      import java.awt.*;
      import java.awt.event.*;

      public class Test {

          public static void main(String[] args) {

              final Frame f = new Frame("Top Window");
              f.setLayout(new BorderLayout());
              f.setBounds(0, 0, 500, 110);
              f.addWindowListener(new WindowAdapter() {
                  public void windowClosing(WindowEvent ev) {
                      System.exit(0);
                  }
              });

              JTextField text = new JTextField();
              JTextField text1 = new JTextField();
              JButton b = new JButton("Open JDialog");
              JPanel topPanel = new JPanel();
              topPanel.setLayout(new BorderLayout());
              topPanel.add( text, BorderLayout.NORTH );
              topPanel.add( text1, BorderLayout.CENTER );
              topPanel.add( b, BorderLayout.SOUTH );
              f.add(topPanel, BorderLayout.NORTH);
              f.setVisible(true);

              b.addActionListener( new ActionListener(){
                      public void actionPerformed(ActionEvent e)
                      {
                      JDialog jd = new JDialog( f, "Modal JDialog");
                      JButton but = new JButton("JButton");
                      jd.setMinimumSize( new Dimension ( 200,100 ) );
                      jd.setPreferredSize( new Dimension (200,100 ) );
                      jd.setModal(true);
                      jd.setLocation(500,100);
                      jd.setLayout(new BorderLayout());
                      jd.getContentPane().setLayout(new BorderLayout());
                      jd.getContentPane().add( but);
                      jd.setVisible(true);
                      jd.pack();
                      jd.setMinimumSize(jd.getPreferredSize());
                      }
              });
          }
      }

            vikram Vikram Aroskar (Inactive)
            apoddany Arnaud Poddany (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: