java - 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);
解决方案
推荐阅读
- javascript - 内联数组比较函数
- mysql - 如何修复 £ 符号前的特殊字符 - 399 英镑 - Spring Boot json
- sql - 如何查找两个数组是否包含 SQL 中的任何公共项?一个数组是我的设置结果,另一个是“ids”列表?
- c++ - AngelScript 有非内联 asm 版本吗?
- javascript - 二进制浮点到十进制 JavaScript 函数
- python - 为什么异步帧(和对自身的引用)永远不会被释放?
- php - 访问远程数据库在 Laravel 上出现错误
- c# - 当通过 slug 而不是 Id 访问详细信息时,从另一个控制器访问详细信息视图
- prism - 如何在使用 Prism 和 Syncfusion DockingManager 关闭 TabItem 时取消选中复选框
- hugo - 从本地文件系统浏览时,使 hugo 静态网站站点正确导航