---
title: "JTextArea自动滚动到最低端"
author: "给太阳洒水"
date: "2012-07-19T13:41:11Z"
tags: []
categories: ["编程语言"]
slug: "jtextarea"
draft: false
lastmod: "2012-07-19T13:41:11Z"
id: 1600546
url: "https://lisanlai.iteye.com/blog/1600546"
---

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