This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes How to show arabic and arabic in a JTextBox when user enter the numbers? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to show arabic and arabic in a JTextBox when user enter the numbers?" Watch "How to show arabic and arabic in a JTextBox when user enter the numbers?" New topic
Author

How to show arabic and arabic in a JTextBox when user enter the numbers?

raminaa niilian
Ranch Hand

Joined: Jul 14, 2005
Posts: 551
Hi
Thank you for reading my post.
I am looking for a way to show Arabic digits in the JTextBox when user is entering the digitst instead of showing Europian digits. User keyboard layout is Arabic but numbers are shown in euopian instead of arabic.

Thanks.
Francois Nadeau
Ranch Hand

Joined: Apr 09, 2009
Posts: 46
Hi Raminaa,

I have never done this, but I would suggest taking a look at the following link:

http://www.java2s.com/Code/Java/I18N/FormattingMessagesArabicDigit.htm

and then adding a KeyListener to your TextBox. In the listener, whenever the user presses a numeric key you can convert the text by using the above code. It won't be the most efficient way, but it should work fine for small amount of data.

Cheers.

[url]http://FrancoisNadeau.com[/url]
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

I'd use a DocumentFilter instead of a KeyListener, so you can replace numbers in text pasted into the text box as well:


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to show arabic and arabic in a JTextBox when user enter the numbers?
 
Similar Threads
Multilingual support by JTextField
Arabic Digits Encoding
Is It Possible To Set Input Numbers for JTextFiled?
criteriaFind and No available seats.
Arabic numbers input problem(Very Urgent)