要在新的JTextPane上插入滚动条,只需使用JScrollPane:
JTextPane txt = new JTextPane();
JScrollPane jsp = new JScrollPane(txt);
JTextPane API:http ://download.oracle.com/javase/6/docs/api/javax/swing/JTextPane.html
JScrollPane API:http ://download.oracle.com/javase/6/docs/api/javax/swing/JScrollPane.html
如果您有任何问题,请查看以下SO问题: Java JTextPane JScrollPane Display Issue
或看看:http ://www.daniweb.com/software- development/java/threads/30283