473,386 Members | 1,668 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Displaying Chinese and Japanese characters on Swing components.

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 6086
JosAH
11,448 Expert 8TB
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
It is not working...
Jun 24 '08 #3
JosAH
11,448 Expert 8TB
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
here i paste my code.


public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column) {
if (isSelected) {
setForeground(table.getSelectionForeground());
setBackground(table.getSelectionBackground());
} else {
setForeground(table.getForeground());
setBackground(table.getBackground());
}
// setFont(new Font("Arial", Font.BOLD, 12));
//setFont(new Font("MS Gothic", Font.BOLD, 12));
if (hasFocus) {
setBorder(UIManager.getBorder("Table.focusCellHigh lightBorder"));
if (table.isCellEditable(row, column)) {
setForeground(UIManager.getColor("Table.focusCellF oreground"));
setBackground(UIManager.getColor("Table.focusCellB ackground"));
}
} 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 Expert 8TB
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
Thanks! At last it is working....
Jun 26 '08 #7
JosAH
11,448 Expert 8TB
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
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
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,...
1
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...
2
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 =...
11
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...
4
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:...
12
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...
1
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...
1
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...

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.