Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Highlighting text in a JTextArea

Status
Not open for further replies.

tgib

Programmer
Apr 24, 2000
1
US
I have a text area that is populated with some data. The user is allowed to make updates and save it back to the database.&nbsp;&nbsp;They would like to have all current change to be &quot;highlighted&quot; until they have saved them.&nbsp;&nbsp;I can't use caret position and selection, because the edits can be in multiple areas of the same text field.&nbsp;&nbsp;In addition, if the text were selected, it would be replaced with the next keystroke.&nbsp;&nbsp;<br><br>Example.&nbsp;&nbsp;white background, black text.&nbsp;&nbsp;If user adds text, the background should be blue.&nbsp;&nbsp;If they delete text, it should remain on the screen and the background will change to red.&nbsp;&nbsp;If they deleted red background text, it should change back to white (ie: un-delete)<br><br>Does anyone have any suggestions? Thanks Tom
 
I have never used the jtextarea class yet but you might look into the xor method in the graphics class. ? <p>moses<br><a href=mailto:tmoses@iname.com>tmoses@iname.com</a><br><a href= my site</a><br> "We've heard that a million monkeys at a million keyboards could produce the<br>
Complete Works of Shakespeare; now, thanks to the Internet, we know this is<br>
not true." <br>
--Robert Wilensky, University of California <br>
<br>
<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top