🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #10275

Re: Display Chinese Characters in JTextField or JTextArea etc

#10275
From: KW
Date: Fri, 22 Oct 1999 00:00
126 lines
4946 bytes
Hi Lois

Thanks for the help.  But I don't have any Chinese font files.  So
I'm now wondering where  is the MS site for downloading Chinese
font files?  For example the file for SIMSUN.TTF.

Thanks

K W


Lois Neo wrote:

> Hi Kevin,
>
> I'm not a pro, but here's how I done it:
> there are 2 ways to get the thing work -
> 1. set the locale of your display area (e.g. JTextArea, JTextField) to a
> chinese locale.
>        e.g.   setLocale(new Locale("zh", "CN"))  or setLocale(new
> Locale("zh", TW"))
>
>     if you are using Windows98 or NT, the default font used for displaying
> the chinese characters would be SIMSUN.TTF
>     if you don't have the font, then you probably would like to use the 2nd
> way.
>
> 2. If you have some other chinese fonts installed on your system, like MS
> Song, MS Hei etc,
>      you may like to set the font of the JTextArea or JTextField to the
> font.
>      e.g.   setFont(new Font("MS Song", 0, 12))
>
> If you are using method 1, you can substitute the SIMSUN.TTF with other
> chinese font,
> but beware that some fonts support traditional chinese only, and some
> support simplified chinese only.
>
> Using the above 2 methods, it is not necessary to open a chinese viewer
> while running the app.
>
> For mapping of  chinese characters to unicodes, you may use some unicode
> converter provided by some chinese input software like NJStar Communicator.
> Or you may like to try using the "native2ascii" command to convert  all your
> chinese characters (in a file) to unicodes.
> For more information regarding native2ascii, check up the java help
> Internationalization - tools.
>
> Hope it helps.
> Lois
>
> Kevin Wang <kwang@mks.com> wrote in message
> news:380DFDEE.2BABE215@mks.com...
> > Hi Lois
> >
> > Thanks for the help.  However, I still have few doubts if you don't mind:
> >
> > 1. All I'm doing is load characters from a text file and display them as
> >     menu item names.  I've tried writing some characters in Unicode
> >     (for each character I used this style:: \u5C71), but when I load the
> >     file in my Java application these characters showed up as question
> >     marks (?).  I had a Chinese viewer opend while I did this but
> >     obviously it didn't work.  You mentioned about providing chinese
> >     font, do I have to do that, and how should I do that?
> > 2. Is there a code mapping chart that shows the mapping of each
> >     Chinese character (or characters of other language) to its
> >     corresponding Unicode.
> >
> > Thanks again
> >
> > KW
> >
> >
> >
> > Lois Neo wrote:
> >
> > > I've not really tried that out, but I've seen examples on this which
> write
> > > the characters as Unicodes.
> > > If you write in Unicode, you just need to provide a chinese font for the
> > > component which displays the characters.
> > > I guess if you write in chinese characters, you will also need a chinese
> > > input software to be running along with your program in order for you to
> see
> > > the chinese characters. and not all chinese input software would work
> for
> > > this.
> > >
> > > Hope it helps.
> > > Lois
> > >
> > > Kevin Wang <kwang@mks.com> wrote in message
> news:380DC841.FE608D5@mks.com...
> > > > Hi Neo:
> > > >
> > > > I'm new to displaying other language characters so I have a simple
> > > question if
> > > > you can help it would be great!
> > > >
> > > > I'm trying to load a generic text file (a properties file with keys
> and
> > > values)
> > > > with
> > > > characters in any language.  Once I loaded them into a properties
> object I
> > > > display
> > > > them as menu items under a menu.  Anyway, since that text file is
> generic
> > > in any
> > > >
> > > > language, I'm just wondering if the characters in the file should be
> in
> > > unicode,
> > > > OR
> > > > can it just be written in the character of that language(e.g. if the
> > > language is
> > > >
> > > > Chinese do I have to write them in unicode OR can I just write in
> Chinese
> > > > characters)?
> > > >
> > > > Thanks very much
> > > >
> > > > K W
> > > >
> >
Technical Details
Message-ID: <38108FD6.4FC4556B@mks.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7uhr5l$ha99@forums.borland.com> <7uj2bf$s244@forums.borland.com> <7uj89q$s229@forums.borland.com> <380DC841.FE608D5@mks.com> <7ukq0v$de13@forums.borland.com> <380DFDEE.2BABE215@mks.com> <7unhu2$5fk24@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,68e7b9b264b14ab6
X-Google-Attributes: gid111d45,public
From: KW <kwang@mks.com>
Subject: Re: Display Chinese Characters in JTextField or JTextArea etc
Date: 1999/10/22
Message-ID: <38108FD6.4FC4556B@mks.com>
X-Deja-AN: 539316049
Content-Transfer-Encoding: 7bit
References: <7uhr5l$ha99@forums.borland.com> <7uj2bf$s244@forums.borland.com> <7uj89q$s229@forums.borland.com> <380DC841.FE608D5@mks.com> <7ukq0v$de13@forums.borland.com> <380DFDEE.2BABE215@mks.com> <7unhu2$5fk24@forums.borland.com>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing