473,830 Members | 2,036 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Displaying Chinese and Japanese characters on Swing components.

27 New Member
Hi,

I'm having problems displaying Chinese and Japanese characters on Swing components. I know some conversion should be done. Do you have some source code sample or any idea ?

Thanks!
vaskar
Jun 20 '08 #1
8 6159
JosAH
11,448 Recognized Expert MVP
Hi,

I'm having problems displaying Chinese and Japanese characters on Swing components. I know some conversion should be done. Do you have some source code sample or any idea ?
Most likely your selected font can't display the glyphs of any CJK character.
Try to set the font to "Arial MS Unicode" if you're running on an MS Windows
computer. There is no need to convert the String itself.

kind regards,

Jos
Jun 20 '08 #2
vaskarbasak
27 New Member
It is not working...
Jun 24 '08 #3
JosAH
11,448 Recognized Expert MVP
It is not working...
Can you show us a bit of relevant code? Just a few lines please.

"it is not working" is too vague to answer. Can you select the font I mentioned?
Can you read your Chinese/Japanese data correctly?

kind regards,

Jos
Jun 24 '08 #4
vaskarbasak
27 New Member
here i paste my code.


public Component getTableCellRen dererComponent( JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column) {
if (isSelected) {
setForeground(t able.getSelecti onForeground()) ;
setBackground(t able.getSelecti onBackground()) ;
} else {
setForeground(t able.getForegro und());
setBackground(t able.getBackgro und());
}
// setFont(new Font("Arial", Font.BOLD, 12));
//setFont(new Font("MS Gothic", Font.BOLD, 12));
if (hasFocus) {
setBorder(UIMan ager.getBorder( "Table.focusCel lHighlightBorde r"));
if (table.isCellEd itable(row, column)) {
setForeground(U IManager.getCol or("Table.focus CellForeground" ));
setBackground(U IManager.getCol or("Table.focus CellBackground" ));
}
} else {
setBorder(new EmptyBorder(1, 2, 1, 2));
}
setFont(new Font("Arial MS Unicode", Font.BOLD, 12));
setText((value == null) ? "" : value.toString( ));
return this;
}


Yes read Chinese/Japanese data correctly.

Thanks!
vaskar
Jun 24 '08 #5
JosAH
11,448 Recognized Expert MVP
We have to disect this nasty little problem step by step then; does your value.toString( )
return the correct String? Does an Arial MS Unicode font exist on your computer?
What is the range of characters it can render? (see the Font class API docs).

kind regards,

Jos
Jun 24 '08 #6
vaskarbasak
27 New Member
Thanks! At last it is working....
Jun 26 '08 #7
JosAH
11,448 Recognized Expert MVP
Thanks! At last it is working....
You're welcome of course; what was the problem actually? Maybe other readers
are interested in your problem and solution.

kind regards,

Jos
Jun 26 '08 #8
Shilpa Indian
1 New Member
I had the same problem. Using Font Helvetica in place of Arial solved the problem
Aug 27 '13 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

2
5193
by: Jim E. | last post by:
Using VC++ on an application for English Win 95/98 thru XP, how can I display multi-byte characters (Asian languages or roman characters with accent marks) in standard MFC controls like CEdit, RichEdit, ListCtrl's, etc? I know how to print Japanese/Chinese characters in CDCs using the correct code page and MultiByteToWideChar, but I cannot get even pinyin accent marks or any Asian characters to display in MFC controls. Do you have to...
1
12006
by: GPenn | last post by:
SQL 2000, latest SP. We currently have the need to store data from a UTF-8 application in multiple languages in a single database. Our findings thus far support the fact that single-byte and double-byte characters can be held in the same DB without issue. However, when holding two sets of DIFFERING double-byte characters (i.e. Chinese and Japanese) there are issues. Since Japanese has a superset of both Kanji and Katakana characters...
2
3705
by: Joseph | last post by:
Hello. I have this problem. See I have a transformed XML file and I checked its contents prior to outputting it to excel file via responseset. here is the gist of the code: XmlReader reader = myEsiCommand.ExecuteXmlReader(); reader.MoveToContent(); string myCSV = reader.ReadInnerXml(); //Load the xml fragment into the document XmlDocument xmlDataDoc = new XmlDocument();
11
4777
by: prats | last post by:
I want to write a GUI application in PYTHON using QT. This application is supposed to take in Japanese characters. I am using PyQt as the wrapper for using QT from python. I am able to take input in japanese. But I am unable to display them back to GUI. It displays some junk characters Can anyone suggest me some way how to debug the issue. The code used for tranferring data from view to document is: " codec =...
4
2253
by: wheel | last post by:
I have already built in support for multiple languages in some of my applications, but so far they have only used Western languages (English, Spanish, etc). I need to add some Far East languages: Korean, Japanese, and Chinese. Can anyone with experience in this area tell me of any special considerations? Access 2003. I've read here that the database sort order should be set to the appropriate setting and then compacted. I read too...
12
2749
by: Steve Howell | last post by:
The never-ending debate about PEP 3131 got me thinking about natural languages with respect to Python, and I have a bunch of mostly simple observations (some factual, some anecdotal). I present these mostly as food for thought, but I do make my own continent-by-continent recommendations at the bottom of the email. (My own linguistic biases are also disclosed at the bottom of the email.) Nationality of various technologists who use...
1
2271
by: greggorob64 | last post by:
Hello, I am working with a system developed several years ago, and was recently internationalized to support unicode languages. I am running into a very frustrating and challenging problem: In 99% of the textboxes, entering chinese (or japanese or arabic) characters (using windows IME), in any amount and length, will show up and puts random characters int he textbox (sometimes '?', sometimes a box, sometimes a different chinese char,...
1
4472
MrPickle
by: MrPickle | last post by:
I am tokenizing a string and sending it to a ofstream but I am getting strange results. The \n sequence isn't working; it doesn't go to a new line. I'm getting Chinese/Japanese characters in the file. I think this may be due to compiling the project with the unicode character set rather than multibyte character set, but that's a guess. Here's my code: void Tokenize(std::string str, std::vector<std::string>& vs)
0
9642
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10777
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10526
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7747
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6951
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5617
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5780
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4416
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3960
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.