Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-25-2007, 07:18 PM
Member
 
Join Date: May 2007
Posts: 2
Rep Power: 0
Ashley is on a distinguished road
Default How to always show the last line in my JTextArea?
What lines of code do i need to add to my program for showing always the "last line" in my JTextArea mounted in a JScrollpane?
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 05-26-2007, 01:01 PM
Member
 
Join Date: May 2007
Posts: 7
Rep Power: 0
FaRuK is on a distinguished road
Default
You can use the following code segment:

Code:
JTextArea ta;
String s = ta.getText();
int pos = s.length();
ta.setCaretPosition(pos);
You can call this whever a change event occured in your text area.
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Last line in JTextArea wont display Chris.Brown.SPE Advanced Java 5 04-11-2008 01:52 PM
How to Show Calendar praveen.kb AWT / Swing 2 02-09-2008 08:23 AM
netbeans 6.0 not show commpunent or show blank page fahimaamir NetBeans 1 01-26-2008 06:20 AM
Reading in data from file line by line bluekswing New To Java 1 10-02-2007 12:19 AM
show a RTF FORMAT Jack Advanced Java 2 07-04-2007 03:37 AM


All times are GMT +2. The time now is 04:37 PM.



VBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org