JTextArea自动滚动到最低端

阅读更多

……
jScrollPane = new JScrollPane(infoArea);
……
//自动滚动方法  
     public void scrollToView(){  
    	 if(jScrollPane != null && infoArea != null){
    		 Point   p   =   new   Point(); 
             if   (!infoArea.getScrollableTracksViewportHeight())   { 
                 p.setLocation(0,   infoArea.getHeight()); 
                 this.jScrollPane.getViewport().setViewPosition(p); 
             } 
    	 }
     } 

 

你可能感兴趣的:(JTextArea自动滚动到最低端)