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

REGRESSION: ActionMap misses VK_PRINTSCREEN

XMLWordPrintable

    • tiger
    • x86
    • windows_nt



      Name: rmT116609 Date: 06/24/2002


      FULL PRODUCT VERSION :
      java version "1.4.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
      Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

      FULL OPERATING SYSTEM VERSION :
      Windows NT Version 4.0

      A DESCRIPTION OF THE PROBLEM :
      VK_PRINTSCREEN is not delivered to actions in ActionMap.
      Note that neither key-press nor key-release is working, so
      this is NOT bug 4455060.

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

      public class PrintTest extends JFrame {

        private JTextField textField = new JTextField(10);

        public PrintTest() {
          JPanel panel = new JPanel();
          setContentPane(panel);
          panel.add(textField);

          panel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put
      (KeyStroke.getKeyStroke(KeyEvent.VK_PRINTSCREEN,
      0 ), "PRESSED");
          panel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put
      (KeyStroke.getKeyStroke(KeyEvent.VK_PRINTSCREEN, 0,
      true), "RELEASED");
          panel.getActionMap().put("PRESSED", new AbstractAction
      () {
            public void actionPerformed(ActionEvent ev) {
              System.out.println("ActionMap pressed");
            }
          });
          panel.getActionMap().put("RELEASED", new AbstractAction
      () {
            public void actionPerformed(ActionEvent ev) {
              System.out.println("ActionMap released");
            }
          });
        }

        public static void main(String[] args) {
          PrintTest test = new PrintTest();
          test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          test.pack();
          test.setVisible(true);
        }
      }


      REGRESSION. Last worked in version 1.3.1

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Compile and run class PrintTest
      2. Hit the "Printscreen" button


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      "ActionMap released" should be printed on the console but
      nothing happens.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;

      public class PrintTest extends JFrame {

        private JTextField textField = new JTextField(10);

        public PrintTest() {
          JPanel panel = new JPanel();
          setContentPane(panel);
          panel.add(textField);

          panel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put
      (KeyStroke.getKeyStroke(KeyEvent.VK_PRINTSCREEN, 0 ), "PRESSED");
          panel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put
      (KeyStroke.getKeyStroke(KeyEvent.VK_PRINTSCREEN, 0, true), "RELEASED");
          panel.getActionMap().put("PRESSED", new AbstractAction() {
            public void actionPerformed(ActionEvent ev) {
              System.out.println("ActionMap pressed");
            }
          });
          panel.getActionMap().put("RELEASED", new AbstractAction() {
            public void actionPerformed(ActionEvent ev) {
              System.out.println("ActionMap released");
            }
          });
        }

        public static void main(String[] args) {
          PrintTest test = new PrintTest();
          test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          test.pack();
          test.setVisible(true);
        }
      }

      ---------- END SOURCE ----------

      Release Regression From : 1.3.1_03
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.

      (Review ID: 158336)
      ======================================================================

            apikalev Andrey Pikalev
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: