JDK-8311942 : Dead circumflex stay active after action associated with circumflex not works
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 8u151
  • Priority: P3
  • Status: Resolved
  • Resolution: Duplicate
  • OS: windows_10
  • CPU: x86_64
  • Submitted: 2023-07-03
  • Updated: 2023-07-12
  • Resolved: 2023-07-12
Related Reports
Duplicate :  
Description
ADDITIONAL SYSTEM INFORMATION :
Microsoft Windows 10 Enterprise, German key board

A DESCRIPTION OF THE PROBLEM :
I have already reported this issue here https://bugs.java.com/bugdatabase/view_bug?bug_id=JDK-8308883
After I shared clipping for this issue, I have got information sent to my mailbox that this ticket is investigated and information will be updated. 

until jre1.8.0_151 circumflex dead key was "deactivated" after the action associated with circumflex key was enabled is UI. 
after jre1.8.0_152 circumflex dead key stay "active" for the same application

REGRESSION : Last worked in version 8

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile with jdk8u151 - to check expected behavior 
Enable German keyboard layout. Start the program given in the souce code. Press dead circumflex key aka (^) on qwertz or (~) on qwerty keyboard. 
New window called "popup" will open. Then click on textfield and press "a" key.

Repeat all steps compiling with jdk8u152 to see unexpected behavior

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
TextField shows: a   (works until jre1.8.0_151)
ACTUAL -
TextField shows: รข   (on jre1.8.0_152)

---------- BEGIN SOURCE ----------
import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.KeyStroke;

public class Demo
{

    public void buildGui(){
        JFrame frame = new JFrame("key buttons");
        JPanel panel = new JPanel(new BorderLayout());
        JButton a = new JButton("Open popup");
        panel.add(a, BorderLayout.CENTER);

        frame.setContentPane(panel);
        frame.setVisible(true);
        frame.pack();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setFocusTraversalKeysEnabled(false);
        
        KeyStroke us = KeyStroke.getKeyStroke(KeyEvent.VK_DEAD_CIRCUMFLEX, 0, false);
        panel.getInputMap().put(us, "A");

        panel.getActionMap().put("A", new AbstractAction(){
            @Override
            public void actionPerformed(ActionEvent evt){
               openWindow();
            }
        });
    }

    private void openWindow(){
        JFrame frame = new JFrame("Popup");
        JPanel panel = new JPanel(new BorderLayout());
        JTextField textField = new JTextField(30);
        panel.add(textField, BorderLayout.CENTER);
        frame.setContentPane(panel);
        frame.setVisible(true);
        frame.pack();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

    public static void main(String[] args){
        EventQueue.invokeLater( new Demo()::buildGui);
    }
}
---------- END SOURCE ----------

FREQUENCY : always



Comments
Duplicate of JDK-8308883
12-07-2023