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

Modifiers of swing ActionEvent does not work when "-Djavafx.embed.singleThread=true"

XMLWordPrintable

    • b25
    • x86
    • windows_8

      FULL PRODUCT VERSION :
      java version "1.8.0_73"
      Java(TM) SE Runtime Environment (build 1.8.0_73-b02)
      Java HotSpot(TM) 64-Bit Server VM (build 25.73-b02, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      In a swing window, with jvm option -Djavafx.embed.singleThread=true
      when I click on a JButton with CTRL (or SHIFT),
      THEN the modifiers of the ActionEvent is always 0


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      In a swing window, with jvm option -Djavafx.embed.singleThread=true
      when I click on a JButton with CTRL (or SHIFT),
      THEN the modifiers of the ActionEvent is always 0

      See code sample to reproduce problem:

          public static void main(String[] args) {

              JFXPanel jfxPanel = new JFXPanel();

              JButton button = new JButton("Another test");
              button.addActionListener(e -> System.out.println(e.getModifiers()));

              JPanel panel = new JPanel(new BorderLayout());
              panel.add(button);

              JFrame frame = new JFrame("Tests");
              frame.setContentPane(panel);
              frame.setSize(new Dimension(150, 150));

              SwingUtilities.invokeLater(() -> frame.setVisible(true));
          }

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The modifiers of ActionEvent should not be 0 if CTRL or Shift was used
      ACTUAL -
      The ActionEvent.getModifiers() always return 0

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------

          public static void main(String[] args) {

              JFXPanel jfxPanel = new JFXPanel();

              JButton button = new JButton("Another test");
              button.addActionListener(e -> System.out.println(e.getModifiers()));

              JPanel panel = new JPanel(new BorderLayout());
              panel.add(button);

              JFrame frame = new JFrame("Tests");
              frame.setContentPane(panel);
              frame.setSize(new Dimension(150, 150));

              SwingUtilities.invokeLater(() -> frame.setVisible(true));
          }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Do not use -Djavafx.embed.singleThread=true

            psadhukhan Prasanta Sadhukhan
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: