Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

i have another problem?  RSS feed

 
ali rafiq
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
.. i have got my font on TextPane but the character start with the Left side..like at the
ABC ..but in my language its start with the Rigth side like CBA.. i have took the aling to right its works like the text start from the right but the cursur of text area still at its place dont take the next position..? please help me? i have send the code at my last message
 
Craig Baxter
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could always cheat create a separate class that takes in a string and returns the same string back only in reverse (wouldnt be too hard to implement - simply assign the string to a inputstring.toCharArray(), then create another array of chars of the same size and read in the input chars from last to first and store them in the output array.
Probably not the best way of doing it, but it'd work.
Craig
PS: If you cant do it - I'll write it for you if you ask nicely craigbaxter03@hotmail.com
 
Chris Shepherd
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
could you set up a customized textPane that becomes a keylistener of itself. On keypress, setCaretPosition(0) (far left) so that the next character is "inserted" before all the rest. that should put the new character on the far left.
that sounds like it might work to me.
You would have to implement a special case to handle ENTER/CR or else your text would all jump to the next line... Have to think about that a bit, but it should be doable. Maybe have to wipe out the CR/LF at the beginning of the text and put one in at the end(far right) of the current line. look into that and see if looks like it might work. If its good except for the line feed stuff maybe craig and I could help you work out something to make that work.
I think it might be simpler to implement than Craig's, but his would probably work too.
HTH
[ February 21, 2003: Message edited by: Chris Shepherd ]
 
Ashish Mahajan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
use "textArea.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);"
If u want to set any component's orientation use this method it's in Component so all inherit it. However Sun is providing RTL (Right-to-Left) support gradually. So u need to check the sun's docs.
Also when the application's language changes it's always better to restart the whole application and check the root pane's all component's orientation recursively and if it's not the orientation for the current locale then set it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!