JDK-6240755 : Swing rendering error for Turkish locale on XP look and feel
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 5.0
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2005-03-15
  • Updated: 2014-02-27
  • Resolved: 2005-07-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0u5 b03Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.5.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP SP1 [version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
JRadioButtons are rendered without the radio button part when running with a default locale set to tr_TR and the Windows look and feel selected.

The problem only exists when Windows is run with the Windows XP layout. JRadioButtons display correct when the Windows Classic Layout is selected.

The problem exists for both J2SE 1.4 and 1.5.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
This minimum example displays the problem every time:

import javax.swing.*;
import java.awt.event.*;
import java.awt.GridLayout;
import java.util.Locale;

public class TR_RadioButton extends JFrame {
  public TR_RadioButton(String name) {
    super(name);
    ButtonGroup bg = new ButtonGroup();
    JRadioButton radio1 = new JRadioButton("Test 1");
    JRadioButton radio2 = new JRadioButton("Test 2");
    bg.add(radio1);
    bg.add(radio2);
    getContentPane().setLayout(new GridLayout(2, 1));
    getContentPane().add(radio1);
    getContentPane().add(radio2);
    setSize(100, 100);

    addWindowListener(new WindowAdapter() {
        public void windowOpened(WindowEvent evt) {
        }
        public void windowClosing(WindowEvent evt) {
          System.exit(0);
        }
      });
  }

  public static void main(String[] args) {
    // radio buttons rendered correct for US and other locales
//     Locale.setDefault(Locale.US);
    // radio buttons incorrectly rendered for tr_TR (Turkish) locale
    // with Windows XP Layout
    Locale.setDefault(new Locale("tr", "TR"));

    // rendering is only incorrect for WindowsLookAndFeel so it the
    // below lines are commented out rendering is OK
    try  {
      UIManager.setLookAndFeel(new com.sun.java.swing.plaf.windows.WindowsLookAndFeel());
    }
    catch (Exception e) {
      e.printStackTrace();
    }

    JFrame f = new TR_RadioButton("Invisible radio buttons");
    f.setVisible(true);
  }
}

Steps to reproduce:
1. Compile the above example on J2SE 1.4 or 1.5
2. Make sure that Windows XP Layout has been selected in Windows setting for the desk top/screen
3. Run the example with the command "java -cp . TR_RadioButton"
4. A JFrame is display with two radio buttons but without rendering of the check box parts.
5. While the JFrame is displayed change to Windows Classic Layout in the Windows setting for the desk top/screen. Notice that radio buttons now display as expected.

6. Now select Windows XP Layout again. Edit the example program setting the default locale to Locale.US. Recompilne and run. Verify that radio buttons are now rendered as expected.
7. Last edit the example program again. Set default locale to tr_TR again and comment out selection of Windows look and feel. Recompile and run. Verify that radio buttons for this combination is also rendered as expected.


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
JRadioButton should render with correct chech boxes on Windows XP look and feel for all combinations of locales, including the turkish tr_TR locale. Makes it kind of hard for turkish speaking users to see the current selection for a JRadioButton.
ACTUAL -
With a combination of tr_TR locale on Windows XP look and feel the current selection of a group of JRadioButtons can not be determined.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
- Compile with "javac TR_RadioButton.java"
- Run with "java -cp . TR_RadioButton"

import javax.swing.*;
import java.awt.event.*;
import java.awt.GridLayout;
import java.util.Locale;

public class TR_RadioButton extends JFrame {
  public TR_RadioButton(String name) {
    super(name);
    ButtonGroup bg = new ButtonGroup();
    JRadioButton radio1 = new JRadioButton("Test 1");
    JRadioButton radio2 = new JRadioButton("Test 2");
    bg.add(radio1);
    bg.add(radio2);
    getContentPane().setLayout(new GridLayout(2, 1));
    getContentPane().add(radio1);
    getContentPane().add(radio2);
    setSize(100, 100);

    addWindowListener(new WindowAdapter() {
        public void windowOpened(WindowEvent evt) {
        }
        public void windowClosing(WindowEvent evt) {
          System.exit(0);
        }
      });
  }

  public static void main(String[] args) {
    // radio buttons rendered correct for US and other locales
//     Locale.setDefault(Locale.US);
    // radio buttons incorrectly rendered for tr_TR (Turkish) locale
    Locale.setDefault(new Locale("tr", "TR"));

    // rendering is only incorrect for WindowsLookAndFeel
    // rendering is correct for other look and feels
    try  {
      UIManager.setLookAndFeel(new com.sun.java.swing.plaf.windows.WindowsLookAndFeel());
    }
    catch (Exception e) {
      e.printStackTrace();
    }

    JFrame f = new TR_RadioButton("Invisible radio buttons");
    f.setVisible(true);
  }
}

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

CUSTOMER SUBMITTED WORKAROUND :
none found (other than selecting to run Windows XP using the classic layout).
###@###.### 2005-03-15 12:15:38 GMT

----------------------------------

Additional information: Most Swing components fail to render correctly in the
Turkish or Azeri locales. This problem does not only apply to JComboBox.
###@###.### 2005-06-07 06:32:10 GMT

Comments
EVALUATION This is reproducible in 5.0. It is not reproducible 1.4.2, nor in 6.0 beta after fix for 5106661. The cause for this bug is as described in bug 6208680, which indicates that the fix would be to specify the locale Locale.ENGLISH for system string manipulation in the classes sun.awt.windows.ThemeReader and com.sun.java.swing.windows.XPStyle. ###@###.### 2005-06-07 06:32:10 GMT
14-04-2005