how to get selected chracter position in JTextArea?
Posted
by Reddy
on Stack Overflow
See other posts from Stack Overflow
or by Reddy
Published on 2010-05-28T13:39:24Z
Indexed on
2010/05/28
13:42 UTC
Read the original article
Hit count: 227
Hi! Here is a challenging question!
Let me first tell you my scenario how am i implementing a solution to a problem.
I am reading a log file and displaying it on the JTextArea. Log file is cp037 character coded. I was reading each file as a byte stream or byte array from the log file & displaying it. Anyways, i managed to display the text properly in JTextArea by cp037 character coding.
Now, User may select a set of characters in the JTextArea. All i want is the position of first character of the user's selected text, from a nearest special character '+'(its character code in cp037 is 4E), which is prior to the selected text. This character may occur at several places in the JTextArea.
In simple sentence, i want the first character location(of user selected text) from nearset '+' which should be occuring prior to the user's selected text.
PS: cp037 is a type of character encoding scheme which is created by IBM & used for IBM Mainframes.
Please fell free to ask me if the question is not clear...:->
© Stack Overflow or respective owner