Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Java
Expertise: Beginner
Jul 24, 1998

Text Area and Cursor Control

The java.awt.TextComponent class (from which TextArea is derived) has three methods to retrieve mouse selection information. The getSelectedText() method will return a String containing the selected text, and the getSelectionStart() and getSelectionEnd() methods will return the start and end positions of the selected text. If getSelected() returns null, then no text is selected. The TextArea component provides a method called replaceRange() (formerly replaceText() in JDK 1.0.2), with which you can replace the contents of part of the TextArea.
Daniel Savarese
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date