My Oracle Support Banner

[MacOS] Java JTextField Character Does Not Display after Input of Single Quote, Using 'US International-PC' Keyboard Layout (Doc ID 2487539.1)

Last updated on FEBRUARY 05, 2020

Applies to:

Java SE JDK and JRE - Version 8 and later
Information in this document applies to any platform.

Symptoms

When 'US International - PC' keyboard layout is used on MacOS, a consonant character entered in a JTextField does not render if it is immediately preceded by a single quote or apostrophe character (').  This problem occurs only with Java applications and does not occur with native applications.  For example, entering  'v  produces  'v  in native applications and only  '  in Java applications.

The issue can be reproduced with the following steps:

  1. On MacOS, attach a US International - PC keyboard
  2. Install Java
  3. Compile the following sample program, named JTextFieldTest.java:
import javax.swing.*;

public class JTextFieldTest {
    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                JFrame frame = new JFrame();
                frame.add(new JTextField(20));
                frame.pack();
                frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
                frame.setVisible(true);
                frame.setLocationRelativeTo(null);
            }
        });
    }
}

5. After text field appears, type single quote (apostrophe) character ('), then type the letter v.
6. Notice the result is only a single quote (apostrophe) character (') is displayed.

Changes

The issue affects the following releases:

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Changes
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.