ScrollPane 文本总是从底部开始

问题描述

基本上我的程序有一个 JTabbedPane,每个标签在 JTextPane 中都有一个 JScrollPane。不知何故,但文本总是从底部开始。我该如何解决?

我试着把这个,但没有奏效。

JScrollBar vertical = scrollPane.getVerticalScrollBar();

JScrollPane scrollPane = new JScrollPane();
scrollPane.setEnabled(false);
scrollPane.setBounds(10,36,973,492);
panel.add(scrollPane);
JScrollBar vertical = scrollPane.getVerticalScrollBar();
vertical.setValue(vertical.getMaximum()); 

JTextPane textPane = new JTextPane();
textPane.setEditable(false);
textPane.setFont(new Font("Calibri Light",Font.BOLD,20));
textPane.setText("blahblahbalhtonsoftexthere");
scrollPane.setViewportView(textPane);

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)