Results 1 to 2 of 2
  1. #1
    Ashley is offline Member
    Join Date
    May 2007
    Posts
    2
    Rep Power
    0

    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?

  2. #2
    FaRuK is offline Member
    Join Date
    May 2007
    Posts
    7
    Rep Power
    0

    Default

    You can use the following code segment:

    Java 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.

Similar Threads

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •