Why Chinese characters not showing up in JLabel correctly , sometimes ?

I have a large program which uses a JLabel to display some Chinese characters in html, it was doing fine until the program grew larger and larger, then only html fonts in certain sizes will show up correctly, other sizes of the same fonts will show up as rectangles. It's not because it doesn't have these fonts, but it seems to be related to the complexity of the program. If I change the characters in rectangles to a different size ( smaller or larger ), they might show up correctly again (in the large program).
I have a small test program below to see if a particular font size would show up correctly, they all showed up fine in this test, but if I try to display the same html in my large program, some sizes of characters will go wrong. I've even printed out the unicode and looked at them (6309 4f60 7684 9700 8981 ...), they are definitely in the Chinese character range.
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Java_Test extends JPanel
  static int Total=900;
  JComboBox ComboBox_Array[]=new JComboBox[Total];
  Font Times_New_Roman_15_Font=new Font("Times New Roman",0,15);
  static int Small_Chinese_Font_Size=3;
  static String Software_Info_Chinese_Text="<Html><Table Width=100% Border=0 Cellpadding=2 Cellspacing=3><Tr><Td Align=Center><Font Size=6 Color=#3737FF>[ \u4EA7\u54C1\u7BA1\u7406 ] </Font></Td></Tr>"+
                                           "<Tr><Td Align=Center><Font Size=5 Color=green>\u5E2E\u52A9\u4F60\u7BA1\u7406\u4EA7\u54C1, \u5408\u540C, \u53CA\u5176\u5B83\u4FE1\u606F :</Font></Td></Tr>"+
                                           "<Tr><Td>\u8F93\u5165<Font Size="+Small_Chinese_Font_Size+" Color=#2255BB>"+
                                             "<li>\u8F93\u5165, \u7EF4\u62A4\u548C\u6253\u5370\u8BE6\u7EC6\u4EA7\u54C1\u53CA\u4F9B\u8D27\u5546\u4FE1\u606F<Br>"+
                                             "<li>\u5730\u5740\u548C\u5907\u6CE8\u4FE1\u606F\u53EF\u7528\u591A\u79CD\u8BED\u8A00\u8F93\u5165<Br>"+
                                           "</Font></Td></Tr>"+
                                           "</Table></Html>";
  JPanel Main_Panel=new JPanel();
  static boolean Exit_When_Window_Closed=false;
  Java_Test(String Test_String)
    for (int i=0;i<Total;i++) ComboBox_Array=new JComboBox();
JLabel A_Non_English_Label=new JLabel(Test_String);
A_Non_English_Label.setFont(Times_New_Roman_15_Font);
A_Non_English_Label.setForeground(Color.BLUE);
add(A_Non_English_Label);
setPreferredSize(new Dimension(600,300));
void Show_Up()
Main_Panel.add(this);
Dimension Screen_Size=Toolkit.getDefaultToolkit().getScreenSize();
final JFrame frame=new JFrame("Java Test");
frame.add(Main_Panel);
frame.addWindowListener(new WindowAdapter()
public void windowClosing(WindowEvent e) { if (Exit_When_Window_Closed) System.exit(0); }
public void windowDeiconified(WindowEvent e) { Main_Panel.repaint(); }
public void windowGainedFocus(WindowEvent e) { Main_Panel.repaint(); }
public void windowOpening(WindowEvent e) { Main_Panel.repaint(); }
public void windowResized(WindowEvent e) { Main_Panel.repaint(); }
public void windowStateChanged(WindowEvent e) { Main_Panel.repaint(); }
frame.pack();
frame.setBounds((Screen_Size.width-Main_Panel.getWidth())/2,(Screen_Size.height-Main_Panel.getHeight())/2-10,Main_Panel.getWidth(),Main_Panel.getHeight()+50);
frame.setVisible(true);
Main_Panel.updateUI();
static void Out(String message) { System.out.println(message); }
public static void main(String[] args)
Exit_When_Window_Closed=true;
new Java_Test(Software_Info_Chinese_Text).Show_Up();
final Java_Test demo=new Java_Test(Software_Info_Chinese_Text);
Dimension Screen_Size=Toolkit.getDefaultToolkit().getScreenSize();
final JFrame frame=new JFrame("Java Test");
frame.add(demo);
frame.addWindowListener(new WindowAdapter()
public void windowClosing(WindowEvent e) { System.exit(0); }
public void windowDeiconified(WindowEvent e) { demo.repaint(); }
public void windowGainedFocus(WindowEvent e) { demo.repaint(); }
public void windowOpening(WindowEvent e) { demo.repaint(); }
public void windowResized(WindowEvent e) { demo.repaint(); }
public void windowStateChanged(WindowEvent e) { demo.repaint(); }
frame.pack();
frame.setBounds((Screen_Size.width-demo.getWidth())/2,(Screen_Size.height-demo.getHeight())/2-10,demo.getWidth(),demo.getHeight()+38);
frame.setVisible(true);
I called this test program from my large program, and it won't display correctly, it will only display all sizes of characters correctly if I run the test program by itself.
I've posted a similar question in Java/Swing but got no answer. So I'm trying it here. The above test program will compile and run, it can display all sizes of html fonts correctly.Which means it's not lacking any fonts. I've even tried the following in my large program :
dialog.validate();
dialog.repaint();
pane.validate();
pane.repaint();
pane.updateUI();
A_Label.validate();
A_Label.repaint();
A_Label.updateUI();
Still doesn't work, does anyone know why and how to fix it ?
Frank                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

I've just made a breakthrough, the large program will work correctly if I comment out : A_Non_English_Label.setFont(Times_New_Roman_15_Font);
But then the font doesn't look the way I wanted it to be.
So I changed it to the following :
================================================
Font Courier_New_15_Font=new Font("Courier New",0,15);
A_Non_English_Label.setFont(Courier_New_15_Font);
================================================
Now it looks not the same but similar to the way I wanted. Thus my question becomes : why it can't work correctly with "Times_New_Roman", but with "Courier_New" in the large program, they both displayed correctly in my small test program ? Is it because it takes too much resource to load the "Times_New_Roman" font ?
Frank

Similar Messages

  • Chinese Characters not showing in Design View

    Version: DW MX 2004
    I have a file I created in FrontPage and am now migrating
    over to DW. Most of the language on the page is English, with a
    portion of Chinese.
    My Chinese characters do not show up in Design View, but when
    I preview or upload the page to the server (live), they show up ok
    in IE and FF. Everything worked fine in FrontPage.
    Why can't I see them in Design View? I have looked in the
    Help for languages, character sets, etc.

    Once again, no one seems to know much about this question.
    (I've noticed it's gone unanswered in previous years.)
    In the Knowledgebase, I find only this: "Encoded HTML
    documents created outside of Dreamweaver may not display correctly
    in Dreamweaver. This includes documents that have been hand-coded
    or created in another HTML editor."
    This was updated in March, 2006.
    Which leads me to say, bugger. I guess there's little point
    in accommodating those 1.2 billion Chinese.

  • Chinese Characters Not Showing On Zen Ne

    Hi, those who are using Zen Neeon or have solutions to my problems, please do help.
    Chinese characters are not showing on my Zen Neeon.
    When I used the Zen Neeon Media Explorer or Creative Mediasource to rip songs from CDs, chinese characters appear perfectly fine. It's also fine when I used Windows Media Player to rip.
    However, once the songs are transferred to the player, chinese characters can't be read when they are playing. They can be read when I view them as 'playlists' on the player, but the Chinese song titles appear as funny characters on the LCD when the songs are playing.
    I have changed my computer's non-unicode to 'Chinese PRC'. So I really don't know what's wrong.
    Please help.
    Thanks!

    It is actually the language of the tag of the song that matters, not the language of the song itself. If the song has Chinese tag, then the language must be set to Chinese. Setting the language to Chinese will not affect songs that has English tag. So, if you have only English tag songs and Chinese tag songs, then setting the language to Chinese will work for both. However, if you have Chinese tag songs and Japanese tag songs, then you need to set the language accordingly, depending on whether you are transferring Chinese tag songs or Japanese tag songs.

  • Chinese characters not showing

    i just installed itunes on my new PC windows 7. the chinese music files show up just fine on my computer browser but when i add them into itunes, the characters all show up funny unidentifiable. please help resolve this problem. thanks:)

    just restarted and everything is ok. strange

  • Chinese characters not showing [through AIRSQL]

    i would to assume that there's ANISI vs UTF8 issue here but don't have a clue where i can go to tweak this.
    (trying to implement chinese(mandarin) names in the adobe employee directory but i only get ???? instead)
    Any Ideas?

    It is actually the language of the tag of the song that matters, not the language of the song itself. If the song has Chinese tag, then the language must be set to Chinese. Setting the language to Chinese will not affect songs that has English tag. So, if you have only English tag songs and Chinese tag songs, then setting the language to Chinese will work for both. However, if you have Chinese tag songs and Japanese tag songs, then you need to set the language accordingly, depending on whether you are transferring Chinese tag songs or Japanese tag songs.

  • Non-English character not showing up in JLabel correctly

    In my program there is a JLabel that displays Chinese characters in several sizes of fonts, it was displaying all of them correctly until my program grew larger and takes longer to initialize, now it is only displaying some sizes of fonts correctly while displaying others as rectangles. Since my program is too large to be imported here, I am trying to demo the problem in a smaller program, but in this smaller program, all sizes of fonts showed up correctly, here it is :
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    public class Java_Test extends JPanel
      static int Total=9000;
      JComboBox ComboBox_Array[]=new JComboBox[Total];
      Font Times_New_Roman_15_Font=new Font("Times New Roman",0,15);
      int Small_Chinese_Font_Size=3;
      String Software_Info_Chinese_Text="<Html><Table Width=100% Border=0 Cellpadding=2 Cellspacing=3><Tr><Td Align=Center><Font Size=6 Color=#3737FF>[ \u4EA7\u54C1\u7BA1\u7406 ] </Font></Td></Tr>"+
                                               "<Tr><Td Align=Center><Font Size=5 Color=green>\u5E2E\u52A9\u4F60\u7BA1\u7406\u4EA7\u54C1, \u5408\u540C, \u53CA\u5176\u5B83\u4FE1\u606F :</Font></Td></Tr>"+
                                               "<Tr><Td><Font Size="+Small_Chinese_Font_Size+" Color=#2255BB>"+
                                                 "<li>\u8F93\u5165, \u7EF4\u62A4\u548C\u6253\u5370\u8BE6\u7EC6\u4EA7\u54C1\u53CA\u4F9B\u8D27\u5546\u4FE1\u606F<Br>"+
                                                 "<li>\u5730\u5740\u548C\u5907\u6CE8\u4FE1\u606F\u53EF\u7528\u591A\u79CD\u8BED\u8A00\u8F93\u5165<Br>"+
                                               "</Font></Td></Tr>"+
                                               "</Table></Html>";
      Java_Test()
        for (int i=0;i<Total;i++) ComboBox_Array=new JComboBox();
    JLabel A_Non_English_Label=new JLabel(Software_Info_Chinese_Text);
    A_Non_English_Label.setFont(Times_New_Roman_15_Font);
    A_Non_English_Label.setForeground(Color.BLUE);
    add(A_Non_English_Label);
    setPreferredSize(new Dimension(500,200));
    static void Out(String message) { System.out.println(message); }
    public static void main(String[] args)
    final Java_Test demo=new Java_Test();
    Dimension Screen_Size=Toolkit.getDefaultToolkit().getScreenSize();
    final JFrame frame=new JFrame("Java Test");
    frame.add(demo);
    frame.addWindowListener(new WindowAdapter()
    public void windowClosing(WindowEvent e) { System.exit(0); }
    public void windowDeiconified(WindowEvent e) { demo.repaint(); }
    public void windowGainedFocus(WindowEvent e) { demo.repaint(); }
    public void windowOpening(WindowEvent e) { demo.repaint(); }
    public void windowResized(WindowEvent e) { demo.repaint(); }
    public void windowStateChanged(WindowEvent e) { demo.repaint(); }
    frame.pack();
    frame.setBounds((Screen_Size.width-demo.getWidth())/2,(Screen_Size.height-demo.getHeight())/2-10,demo.getWidth(),demo.getHeight()+38);
    frame.setVisible(true);
    As you can see, in this smaller program I'm trying to create a Total of 9000 objects to simulate lots of memory use, but to no avail. It is still displaying all sizes of fonts correctly.
    In my large program if I change html font from size 3 to size 5, it will display correctly, it seems that for certain sizes it can't display properly when the program gets too large and complicated, not because I don't have the fonts, but because of the complexity of my program. I wonder if anyone else has similar problems, and how to solve it ?
    Frank                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    I've just made a breakthrough, the large program will work correctly if I comment out : A_Non_English_Label.setFont(Times_New_Roman_15_Font);
    But then the font doesn't look the way I wanted it to be.
    So I changed it to the following :
    ================================================
    Font Courier_New_15_Font=new Font("Courier New",0,15);
    A_Non_English_Label.setFont(Courier_New_15_Font);
    ================================================
    Now it looks not the same but similar to the way I wanted. Thus my question becomes : why it can't work correctly with "Times_New_Roman", but with "Courier_New" in the large program, they both displayed correctly in my small test program ? Is it because it takes too much resource to load the "Times_New_Roman" font ?
    Frank

  • Traditional Chinese Characters Not Showing

    I am using iTunes 8.0 and imported my songs into iTunes. The titles with simplified chinese are able to show up but those with traditional characters showed up as strange characters.
    The songs were imported from another PC with Windows Vista, the titles and tags are all in proper there. I just copied the songs from that PC to my MSI Wind.
    Anyone can help out with my problem?

    tried the software you recommended but it did not help. the characters are all jumbled up in the first place.
    i did not do any changes to the tags when i copied to my MSI Wind. the tags are all right on my original PC, what could have went wrong?

  • Arabic and Chinese characters are showing ??? in PDF

    Hi
    I hava an application which calls BI publisher API to generate PDF file from rtf temlate and xml input. It is fine for English contents. But the Arabic or Chinese characters are showing ??? in PDF. If I use BI publisher Desktop to load the xml and generate pdf file, it shows correct Arabic/Chinese Characters in PDF. I also copied ALBANWTJ.ttf file to my application JAVA_HOME/jre/lib/fonts/ folder. But it still doesn't work. Anyone can help me with this?
    Thanks a lot!

    I created xdo.cfg and put it in my JAVA_HOME/jre/lib/ folder. the file is configured as below:
    <?xml version="1.0" encoding="UTF-8"?>
    <config version="1.0.0" xmlns="http://xmlns.oracle.com/oxp/config/">
    <properties>
    <property name="system-temp-dir">/tmp</property>
    </properties>
    <fonts>
    <font family="Default" style="normal" weight="normal">
    <truetype path="/fonts/ALBANWTJ.ttf"/>
    </font>
    </fonts>
    </config>
    But now I'm getting this error while generating pdf file:
    Adobe Reader could not open 'xxx.pdf' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded).
    Is there anything wrong in my xdo.cfg?
    Thanks!

  • Chinese characters dont show up on the PDF file

    Hi guys,
    Chinese characters dont show up on the PDF file. Its #.
    Please let know how to fix it.
    Thanks!

    Hi,
    I am the facing same problem as you were faced. I am not able to print chinese characters in PDF as it is coming properly in print preview.
    I am sendig this document via email.]
    Pleae help me if any solution with you.
    Thansk and Regards,
    J.P

  • The pdf chinese characters not display (11G  WLS_PERORTS)

    My Database:TRADITIONAL CHINESE_TAIWAN.AL32UTF8
    Environment:xp
    According to:http://docs.oracle.com/cd/E24269_01/doc.11120/e24479/pbr_pdf002.htm#BABCCEAB
    C:\Oracle\Middleware\asinst_1\config\FRComponent\frcommon\tools\COMMON\uifont.ali
    add a row
    [ PDF ]
    .....AL32UTF8 = "MSungStd-Light-Acro"
    But the pdf chinese characters not display,Why??
    http://ppt.cc/h-Tx

    kindly, make sure that you add the font path into your FORMS_PATH in regestery (if you are using windows) also put your font mapping ubder [ PDF:Subset ]
    for example:
    [ PDF:Subset ]
    times = "Barcd39.ttf"
    Arial..italic.Bold.. = "arialbi.ttf"
    Arial..italic... = "ariali.ttf"
    Arial...Bold.. = "arialbd.ttf"
    Arial = "arial.ttf"
    "Andale Duospace WT J" = "Aduoj.ttf"
    "Albany WT J"="AlbanWTJ.ttf"
    "Arabic Transparent"="artro.ttf"

  • In Icloud I can't see my "numbers" icon which i need to select "tick" to transfer data to my other devices via icloud. any ideas why it's not showing up?

    In Icloud on my imac I can't see my "numbers" icon which i need to select "tick" to transfer data to my other devices via icloud. any ideas why it's not showing up?

    You have to do it app wise, which means that the icon won't show up in settings, but you will be able to move files from your local drive to iCloud via the Numbers app (move... > choose the iCloud option).
    It requires that you set up the same iCloud account on all your devices and that you have the latest version of Numbers on all your devices as well.

  • Put movies in itunes on one computer why does it not show up when i access itunes from other computers or ipad2?

    put movies in itunes on one computer why does it not show up when i access itunes from other computers or ipad2?

    i just purchased a file that had videos in it. i put them in the itunes library on my pc where i first downloaded them. i was able to transfer them to my other pc, a laptop, through my home network. i am now trying to get them on my mac pro desktop and my ipad2. my mac pro can see the other computers on my home network but i cannot get it to connect to them. i know the operating systems are different but was hoping i could transfer pictures and files from pc to mac this way. haven't been able to get it to work yet. the videos i am trying to get my mac to see came in a folder with both mac and pc versions. i thought if i got the videos i purchased into itunes that i would then be able to get them to my mac pro and my ipad2. i am new to mac/apple and have always been pc-centric so trying to marry it all has been difficult. i speak pc pretty well but am just learning apple. am i trying to do things that are not possible? i sure could use a knowledgable friendly soul to walk me through my issues of having pc and mac on the same network. i have been able to get all computers and ipad to print on my network. thanks.

  • Certain characters not showing

    I'm having a problem with certain characters not showing on Safari. Some websites are okay, but others, like Livejournal and babynames.com, only show about four characters per word. On some message boards, certain characters such as parentheses and capital L do not show up when I type them, but show up fine on the completed post.
    What is going on? Do I need to download a new copy of Safari, switch to Firefox, or can this be fixed?
    Thanks!

    Apparently it's getting worse. There are eight more letters that don't appear.

  • Why is it not showing in my list of artists?

    I'm new to this stuff so I may sound stupid here. I'm looking for an artist in my list of artist on the IPod itself, and it's not showing. However, if I look under the songs list, the songs that I'm looking for are there. So, why is it not showing the artist in the artist list, but it shows the songs with the correct artist name in the songs list. It also shows the albums by this artist. Any ideas?

    Is it a song on a compilation CD you burned? That might be the case.
    If it's an artist album, you probably need to make sure that Artist and Album Artist have the same information.
    Song: Mercy
    Album Artist: Duffy
    Artist: Duffy
    Would be an example.
    Let me know!

  • Is it free to send messages in iMessage to another county? if yes why it does not show that these messages from iMessage?

    Is it free to send messages in iMessage to another county? if yes why it does not show that these messages from iMessage?

    if you receive an imessage not on any internet connection you will receive it as a sms (green) and yes it counts toward your texting plan

Maybe you are looking for

  • How do i use my web cam, where do i go to, to get started

    Can't figure out where to go to be able to use my web cam. Its not in my devices and printers area.

  • Total in REUSE_ALV_BLOCK_LIST_HS_APPEND

    hi, i am using "REUSE_ALV_BLOCK_LIST_HS_APPEND" to display alv in hierarchy. i have some 5 columns to display, i need to have total for all these 5 columns at the end and text for it as "TOTAL". i have used DO_SUM in fieldcat and declared layout to d

  • Generate the Chart in Excel from Java

    Hi All, I have a typical problem that is I want to generate the Excel charts through Java coding dynamically . Now Iam able to create a excel sheet and populating the Data in that,but Iam not able and not even have the Idea how to generate the Chart

  • Web browser problem on n95 - 1

    Hi guys, about 2 weeks ago, I updated my firmware from v20 to v21, and i've been experiencing problems with my web browser now... before the update, i would surf the net for about 3 or more hours without disruption ( i am connected through wlan)but n

  • Doubt in IDOC Acknowledgements

    Hi, Iam refferering this Blog /people/saravanakumar.kuppusamy2/blog/2005/01/20/configuration-tips-for-a-business-serviceintegration-process-to-send-back-ale-audit-idoc In this blog he took an example of IDOC to File sceanrio and he is saying that we