JDK-4652181 : Chinese can't be displayed with Swing or on JSP pages using JDK1.4.0
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt:i18n
  • Affected Version: 1.4.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2002-03-13
  • Updated: 2002-05-17
  • Resolved: 2002-05-17
Related Reports
Duplicate :  
Description

Name: rmT116609			Date: 03/13/2002


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

FULL OPERATING SYSTEM VERSION :
WINDOWS 2000 SERVER(CHINSESE VERSION)

EXTRA RELEVANT SYSTEM CONFIGURATION :
This error happens on many computers.

A DESCRIPTION OF THE PROBLEM :
Chinese can't be displayed in swing.while it can be displayed with jdk1.3.1

our programmes runs well with jdk1.3.1,but Chinese can't be displayed in jdk1.4.0

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Please try to display Chinese with swing or on jsp pages. It's a difficult job while it's easy in jdk1.3.1

EXPECTED VERSUS ACTUAL BEHAVIOR :
as what you did in jdk1.3.1

This bug can be reproduced always.

---------- BEGIN SOURCE ----------
package com.borland.samples.welcome;

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

public class WelcomeFrame extends JFrame {
  JPanel contentPane;
  BorderLayout borderLayout1 = new BorderLayout();
  JMenuBar jMenuBar1 = new JMenuBar();
  JMenu jMenuFile = new JMenu();
  JMenuItem jMenuFileExit = new JMenuItem();
  JMenu jMenuHelp = new JMenu();
  JMenuItem jMenuHelpAbout = new JMenuItem();

  // Construct the frame
  public WelcomeFrame() {
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    try {
      jbInit();
    }
    catch (Exception e) {
      e.printStackTrace();
    }
  }

  // Component initialization
  private void jbInit() throws Exception {
    contentPane = (JPanel) this.getContentPane();
    contentPane.setLayout(borderLayout1);
    this.setTitle("Welcome to JBuilder,你好");
    this.setJMenuBar(jMenuBar1);
    this.setSize(new Dimension(400, 300));
    jMenuFile.setText("File");
    jMenuFileExit.setText("Exit");
    jMenuFileExit.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        jMenuFileExit_actionPerformed(e);
      }
    });
    jMenuFile.add(jMenuFileExit);
    jMenuHelp.setText("Help");
    jMenuHelpAbout.setText("About世界");//######### Chinese can't be displayed.
    jMenuHelpAbout.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(ActionEvent e) {
        jMenuHelpAbout_actionPerformed(e);
      }
    });
    jMenuHelp.add(jMenuHelpAbout);
    jMenuBar1.add(jMenuFile);
    jMenuBar1.add(jMenuHelp);
  }

  //Overridden so we can exit when window is closed
  protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if (e.getID() == WindowEvent.WINDOW_CLOSING) {
      System.exit(0);
    }
  }

  //File | Exit action performed
  public void jMenuFileExit_actionPerformed(ActionEvent e) {
    System.exit(0);
  }

  //Help | About action performed
  public void jMenuHelpAbout_actionPerformed(ActionEvent e) {
  }
}


package com.borland.samples.welcome;

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

public class WelcomeApp {
  boolean packFrame = false;

  // Construct the application
  public WelcomeApp() {
    WelcomeFrame frame = new WelcomeFrame();

    //Pack frames that have useful preferred size info, e.g. from their layout
    //Validate frames that have preset sizes
    if (packFrame)
      frame.pack();
    else
      frame.validate();

    // Center the frame
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension frameSize = frame.getSize();
    if (frameSize.height > screenSize.height)
      frameSize.height = screenSize.height;
    if (frameSize.width > screenSize.width)
      frameSize.width = screenSize.width;
    frame.setLocation((screenSize.width - frameSize.width) / 2,
(screenSize.height - frameSize.height) / 2);

    frame.setVisible(true);
  }

  // Main method
  static public void main(String[] args) {
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    }
    catch(Exception e) {
      e.printStackTrace();
    }
    new WelcomeApp();
  }
}

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

CUSTOMER WORKAROUND :
I don't know yet.
(Review ID: 144099) 
======================================================================

Comments
EVALUATION I have checked the problem in sparc s9/win98 S-Chinese/WinNT S-Chinese/Win 2000 S-Chinese platforms and found only in Windows 2000 S-Chinese had this problem. So, I went to Display-->Appearance and set the schema to "Windows classic", not to "Windows Standard" and then re-run the WelcomeApp.java. The S-Chinese chars can be popped up in the panel correctly. Please also see bug 4618396. ###@###.### 2002-03-14
11-06-2004