import javax.swing.*;
import java.awt.*;public class ST extends JFrame{
public ST(){
JTextPane jtp = new JTextPane();
JScrollPane jp = new JScrollPane(jtp);
getContentPane().setLayout(new FlowLayout());
getContentPane().add(jp);
setSize(500,300);
setVisible(true);
jp.setSize(200,200);
jtp.setSize(200,200);
}
public static void main(String[] args){
new ST();
}
}具体怎么写比较好你可以使用JB自动生成一下代码试试。