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
8 6086
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
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
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
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
Thanks! At last it is working....
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
I had the same problem. Using Font Helvetica in place of Arial solved the problem
Sign in to post your reply or Sign up for a free account.
Similar topics
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,...
|
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...
|
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 =...
|
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...
|
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:...
|
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...
|
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...
|
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...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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$) {
}
...
|
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...
|
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
|
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...
|
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...
|
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,...
|
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...
| |