寻找一个高效的基于 Java Swing 的控制台

Looking for an efficient Java Swing based console(寻找一个高效的基于 Java Swing 的控制台)
本文介绍了寻找一个高效的基于 Java Swing 的控制台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我正在寻找一个高效的 Swing Java 组件,我可以将其插入到我的应用程序 UI 中.我已经尝试在 Swing 中使用 JTextArea 等类,但无济于事;它们根本不够高性能,并且有任何严重的缺点.此外,如果它具有标准的控制台功能,例如滚动锁定、清晰的控制台、颜色等,那就太好了.

I'm looking for a highly efficient Swing Java component which I can just plug into my application UI. I already tried using the classes within Swing such as JTextArea with no avail; they simply aren't high-performance enough and have any crippling drawbacks. Additionally, it'd be nice if it had standard console features such as scroll-lock, clear console, colours, and so on.

忘了说,这个控制台会有很多调试信息流入,它需要完全可滚动.

Forgot to say, this console will have a lot of debug information streaming into it, and it needs to be fully scrollable.

干杯,
克里斯

推荐答案

我看不出使用 JTextPane 有什么问题.它支持您可以在将每段文本添加到控制台时指定的属性.清除它显然也很容易.添加到滚动窗格时,它还支持滚动.

I fail to see what is wrong with using a JTextPane. It supports attributes which you can specify as each piece of text is added to the console. Clearing it is also obviously a no brainer. When added to a scroll pane it also supports scrolling.

您可以使用 智能滚动添加滚动锁定.

You can add scroll locking by using Smart Scrolling.

另外,它会过早删除文本并且

Plus, it removes text too early and

不知道这意味着什么,因为除非您专门从文档中删除文本,否则永远不会删除文本.

No idea what that means as text is never removed unless you specifically remove it from the document.

不允许用户滚动正在输入输入(afaik).这效果是你只看到文字行数同时闪烁保持不变.

doesn't allow the user to scroll while input is being entered (afaik). The effect is that you just see text flashing while the number of rows remains the same.

默认情况下,假定代码在 EDT 上执行,文本会在文本附加到文档时自动滚动.这种滚动可以通过上面链接中提供的示例来控制.

By default the text scrolls automatically as text is append to the document assuming the code is executed on the EDT. This scrolling can be controlled the the example provided in the link above.

但我仍然想要图书馆解决方案

but I'd still like a library solution

我不知道

自动着色文本来自不同的流

auto-colourise text coming from different streams

消息控制台可能会给您一些想法.

(即,检测 [error] 前缀线)和着色线基于这个)

(i.e., detect [error] prefix on a line) and colourise lines based on this)

这很容易通过将 DocumentFilter 添加到文本窗格的 Document 来完成.您可以在将文本插入文档时添加属性.

This is easily done by adding a DocumentFilter to the Document of the text pane. You can add attributes as text is inserted into the Document.

这篇关于寻找一个高效的基于 Java Swing 的控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Reliable implementation of PBKDF2-HMAC-SHA256 for JAVA(PBKDF2-HMAC-SHA256 for JAVA 的可靠实现)
Correct way to sign and verify signature using bouncycastle(使用 bouncycastle 签名和验证签名的正确方法)
Creating RSA Public Key From String(从字符串创建 RSA 公钥)
Why java.security.NoSuchProviderException No such provider: BC?(为什么 java.security.NoSuchProviderException 没有这样的提供者:BC?)
Generating X509 Certificate using Bouncy Castle Java(使用 Bouncy Castle Java 生成 X509 证书)
How can I get a PublicKey object from EC public key bytes?(如何从 EC 公钥字节中获取 PublicKey 对象?)