Results 1 to 4 of 4
Thread: JLabel Rendering
- 12-12-2008, 06:06 PM #1
Member
- Join Date
- Dec 2008
- Posts
- 2
- Rep Power
- 0
- 12-12-2008, 06:59 PM #2
you could take the String and reverse it then send the reversed string to JLabel which will in turn reverse that string(which will show up in the correct order).
Like orginalString = "abcd" then do a loop from originalString.length to 0 using charAt() to create a new string. JLabel.setText(newString)
- 12-15-2008, 11:09 PM #3
Member
- Join Date
- Dec 2008
- Posts
- 2
- Rep Power
- 0
I discovered that it is not actually reversing the characters. If you use the below array to create a String and then create a JLabel using this String, the JLabel displays the ".txt" portion of the String first. I would expect the ".txt" part to be displayed at the end, since the last four elements represent it.
int[] unicode = {0x0628, 0x0628, 0x0628, 0x0628, 0x0628, 0x002E, 0x0074, 0x0078, 0x0074};
However, when I look at this String in the debugger, I see the foreign characters first followed by the ".txt" part. Also, when I convert the String into a sequence of UTF-8 bytes, create a file using them, and open the file with notepad, I see exactly what the debugger is showing me.
I'm not sure how the JLabel renders characters in a String. Any ideas for this behavior?
- 12-16-2008, 09:55 AM #4
You're mixing right-to-left and left-to-right scripts in the same string. The direction is determined from the first character.
You can confirm this by adding 0x0041 ("A") as the first element of the array.
And your remark:
> I would expect the ".txt" part to be displayed at the end
It is being displayed at the end. For right-to-left scripts, the end is at the left.
db
Similar Threads
-
jLabel
By Matty in forum AWT / SwingReplies: 3Last Post: 09-22-2008, 11:22 PM -
JLabel Array?
By serfster in forum New To JavaReplies: 1Last Post: 06-11-2008, 04:13 AM -
GUI - JLabel
By Azndaddy in forum New To JavaReplies: 8Last Post: 05-02-2008, 08:03 AM -
JLabel
By Jack in forum AWT / SwingReplies: 2Last Post: 07-02-2007, 02:55 PM -
JLabel
By Freddie in forum AWT / SwingReplies: 2Last Post: 05-29-2007, 03:19 PM
Bookmarks