java - How to set and lock the JScrollpane to the bottom? -


how can set jscrollpane bottom of jtextarea? tried defaultcaret caret = (defaultcaret)getcaret(); caret.setupdatepolicy(defaultcaret.always_update); didnt work didnt automatically go down.

here current code

public class subtextareamessages extends jtextarea implements actionlistener{ private arraylist al; public subtextareamessages() {     seteditable(false);     listthemessages();     timer t = new timer(500,this);     t.start(); }  public void listthemessages() {     connectmysql.getusernamestest(this); }  @override public void actionperformed(actionevent e) {      try {         system.out.print(gettext(185,186));     } catch (badlocationexception e1) {         // todo auto-generated catch block         e1.printstacktrace();     } }  }     jsptextfield = new jscrollpane(new subtextareamessages());  mainpanel2.add(jsptextfield ,borderlayout.center); 

depending on exact requirement, 1 of following should help

  1. text area scrolling
  2. smart scrolling

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -