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

REGRESSION:disabling of a JFrame appears to effect the event handling

XMLWordPrintable

    • b04
    • x86
    • linux

        ###@###.### 2004-06-11

        J2SE Version (please include all output from java -version flag):
          Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b51)
          Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode, sharing)

        Does this problem occur on J2SE 1.4 or 1.4.1 or 1.4.2? Yes / No (pick one)
          No. Also doesn't occur with the JDK 1.5.0 in Windows or Solaris.

        Operating System Configuration Information (be specific):
          RedHat Linux 8.0

        Hardware Configuration Information (be specific):
          Pentium II 133MHz 64MB RAM

        Bug Description:
          The disabling of a JFrame in JWindows appears to effect the event
          handling in an independent JWindow. This problem only occurs in
          Linux and the JDK 1.5.0.

        Steps to Reproduce (be specific):

        1) Compile the class JDK150LinuxBug using the JDK 1.2.2 or 1.4.2
        2) execute JDK150LinuxBug.class using the JDK 1.5.0 in Linux.
        3) Clicking on the "Click to Close Me" button has no effect.
          
        However, clicking on the button will close its window if
           a) you execute in Linux using the JDK 1.3 or 1.4 OR
           b) you use the JDK 1.5.0 in Windows or Solaris OR
           c) you comment out the "frame.setEnabled(false);" line.

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

        public class JDK150LinuxBug extends JWindow {

           JButton okBtn;
           Frame parent;
           Thread timer;

           public JDK150LinuxBug(final Frame parent) {
              super(parent);
              this.parent = parent;
              setupGUI();
              setLocation(100, 100);
              setVisible(true);
           }

           synchronized void close() {
              setVisible(false);
              dispose();
           }

           public void setupGUI()
          {
              okBtn = new JButton("Click to Close Me");
              Container contentPane = getContentPane();
              contentPane.setLayout(new BorderLayout());
              contentPane.add(okBtn);
              setSize(250, 250);
              MouseListener mouseListener = new MouseAdapter() {
                 public void mousePressed(MouseEvent ev) {
                    System.out.println("MousePressed ");
                    close();
                 }
              };
              okBtn.addMouseListener(mouseListener);
              okBtn.requestFocus();
           }

           public static void main(String[] args) {
              final Frame frame = new Frame();
              frame.setSize(100, 100);
              frame.setVisible(true);
              frame.setEnabled(false); //Comment this line out to work around bug
              JDK150LinuxBug window = new JDK150LinuxBug(frame);
           }
        }
        //////////////////////////////

              yan Yuri Nesterenko
              tyao Ting-Yun Ingrid Yao (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: