ITeye博客

JTextArea自动滚动到最低端

给太阳洒水 · 2012-07-19 13:41 · java · 编程语言 · Markdown

……
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); 
             } 
    	 }
     } 

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。