JTextField - reading text as it's visual in the field.

Hi all!I want to read text from JTextField into String as it is visual in the field, and not by method getText().(Because I have some BiDirection problems). Does anybody know the way to do that?Thanks in advance, Nemaria.
[256 byte] By [nemaria] at [2007-9-26 3:13:57]
# 1
P. S. i mean all text and not onle its visiable part.
nemaria at 2007-6-29 11:23:44 > top of Java-index,Archived Forums,Swing...
# 2
yourTextfield.getDocument().getText(int start,int end) throws BadLocationExceptionis it ok?
sasivarnan at 2007-6-29 11:23:44 > top of Java-index,Archived Forums,Swing...
# 3
Thank you, but it didn't work. It also returned the text and not its representation in the window.Regards,Nemaria
nemaria at 2007-6-29 11:23:44 > top of Java-index,Archived Forums,Swing...
# 4
What do u meant by "bi-direction problem"?Pls let us know clearly about ur problem.
sasivarnan at 2007-6-29 11:23:44 > top of Java-index,Archived Forums,Swing...
# 5

When user inserted mixed English/Hebrew or mixed English/Arabic text into JText field, I want to build letter by letter a new String str, in which characters will be exactly in the same order (str[0], str[1],...) that they are visible in the JTextField from left to right or from left to right. That's all I want, because then I need this String to build a RTF document, and otherwise a mixed text makes a lot of problems. May be I should use a caret?

nemaria at 2007-6-29 11:23:44 > top of Java-index,Archived Forums,Swing...
# 6
Hi nemaria.I'm not sure I understood what you mean with BiDirection problem but if you want to manage a char as soon as it's typed, implement the KeyListener interface.For everything else, I mean you could use exceptions.Hope it could help.Frd ric.
fredericvander at 2007-6-29 11:23:44 > top of Java-index,Archived Forums,Swing...
# 7

Thanks Frederic!

If I use Listener, I'll get charecters in the order they are printed, and I need to get them in the order they are visible. When you enter the mixed text, part of which is Hebrew/Arabic(from right to left) and part of which is English, you get a big mess in the JText Field.

Maybe I should use BasicTextUI.getNextVisualPositionFrom function? But I don't understand exactly what it does and how it works.

Regards,

Nemaria.

nemaria at 2007-6-29 11:23:44 > top of Java-index,Archived Forums,Swing...