Results 1 to 3 of 3
- 10-18-2011, 12:08 AM #1
Member
- Join Date
- Oct 2011
- Posts
- 24
- Rep Power
- 0
What are the available tricks to hightlight any line in a text containing many lines?
Hi, I have some piece of text contains 20-25lines. I want to draw all the text in a window and dynamically highlight any line of the text. For this reason, i am thinking to design a JPanel, which will put all the text in a textArea first but after that how to highlight the text? Can i change color of any line inside textArea? I guess it is there.
Perhaps i have to use graphics class. but i don't know which one is advisable.
Please suggest some better way in detail.
Thank you.
- 10-18-2011, 02:01 AM #2
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,605
- Rep Power
- 5
Re: What are the available tricks to hightlight any line in a text containing many li
Use the JTextComponent Highligher. Put text in a JTextArea. Get the highlighter and add a new HighlightPainter corresponding to the appropriate offsets
See JTextComponent (Java Platform SE 6)
Googling these terms should bring up a few examples that should get you started
- 10-19-2011, 10:36 AM #3
Member
- Join Date
- Oct 2011
- Posts
- 24
- Rep Power
- 0
Similar Threads
-
Transforming xml to text keeps placing blank line at beginning of text file
By DerekRaimann in forum Advanced JavaReplies: 7Last Post: 03-05-2011, 09:25 AM -
Stepping through a text file line by line
By evanlivingston in forum New To JavaReplies: 10Last Post: 01-29-2011, 04:30 AM -
Reverse search a Text file from last line to top line
By Jman85 in forum New To JavaReplies: 8Last Post: 12-28-2010, 02:24 PM -
How to remove 2 last lines in a text file?
By Marius in forum New To JavaReplies: 2Last Post: 11-30-2008, 03:54 PM -
Remove duplicate lines from a text file
By Dirt.Diver in forum New To JavaReplies: 15Last Post: 06-25-2008, 02:08 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks