JEdi​​torPane 的自动缩放 [英] auto scolling of JEditorPane

查看:21
本文介绍了JEdi​​torPane 的自动缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 JEditorPane 作为编辑器在我的应用程序中编写注释.内容类型设置为text/plain".当我在其中写入文本并且文本填满可用空间并继续输入时,文本不会向上移动以显示光标.所以我不知道我在哪里打字以及我在打什么,因为它是可见的.

I am using a JEditorPane as an editor to write comments in my application. The content type is set "text/plain". When I am writing text in it and the text fills the available space and I go on typing, the text is not moving upward to show the cursor. So I dont know where I am typing and what I am typing since it would be visible.

你能告诉我如何通过向上移动上面的文字来始终显示插入符号吗?

Could you tell me how to always show the caret by moving the above text upwards?

相反,如果我可以在输入时自动调整编辑器的大小会更好.JEdi​​torPane 在 JPanel 内,所以我也必须调整它的大小.有什么想法吗?

Instead, it could be better if I can auto-resize the editor as I am typing. The JEditorPane is inside a JPanel, so I have to resize that too. any Ideas?

推荐答案

您需要将编辑器放在 JScrollPane 中.ScrollPane 将自动添加滚动条并消除调整编辑器大小的需要.

You need to put the editor inside a JScrollPane. The ScrollPane will automatically add scrollbars and remove the need to resize the editor.

这篇关于JEdi​​torPane 的自动缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆