在java语言中,为了制作像textmate这样的文本编辑器,我应该使用什么小部件

发布于 2024-08-06 01:28:06 字数 104 浏览 1 评论 0原文

我想用java写一个文本编辑器。我希望它有一个类似于 textmate 的片段功能。现在我不知道使用什么作为主要编辑器区域。我应该在 swing 中使用一些小部件吗?

非常感谢。

i want to write a text editor in java. i want it have a snippet feature similar to textmate. now i have no idea what to use as the main editor area. should i use some widget in swing?

great thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

单身情人 2024-08-13 01:28:06

由于编辑器(例如 Textmate)的大部分核心附加值是文本编辑视图,因此如果您正在制作文本编辑器,您可能应该从头开始实现视图( JComponent 并覆盖绘图和事件处理)。

相反,如果您想要为另一个项目提供功能丰富的文本编辑组件,那么可以使用 Java 绑定 http://sourceforge。 net/projects/jintilla/ 用于 Scintilla 编辑器,这非常好( SciTE 或 Notepad++ 使用 Scintilla )。

Since a large part of the core added value of an editor such as textmate is the text editing view, if you were making a text editor you probably should implement the view from scratch ( JComponent and override drawing and event handling ).

If instead you want a feature rich text editing component for another project, then there's a Java binding http://sourceforge.net/projects/jintilla/ for the Scintilla editor, which is quite nice ( SciTE or Notepad++ use Scintilla ).

尐偏执 2024-08-13 01:28:06

我想你会想要使用 JTextArea ,并且可能将其包装在 JScrollPane 中。你可能想看看JEdit,它是一个用java编写的文本编辑器,您可以查看源代码并从他们的工作方式中获得一些想法。棘手的部分是处理您尝试创建的代码片段的格式。 JEdi​​t 有针对不同语言的插件,所以我肯定会检查一下它们如何处理事情的一些想法。

I think you are going to want to use JTextArea, and probably wrap it in a JScrollPane. You may want to look at JEdit, it is a text editor written in java, you can view the source and get some ideas from how they are doing things. The tricky part is going to be handling the formatting of snippet you are trying to create. JEdit has plugins for different languages, so I would definitely check that out for some ideas on how they handle things.

迷鸟归林 2024-08-13 01:28:06

如果我明白你想要做什么,你可以使用 JTextArea 来完成此任务。我制作了一个多线程文本编辑器应用程序,它使用 JTextArea 作为主要编辑区域。这没什么特别的,但制作起来很有趣。

If I understand what you're wanting to do, you could use a JTextArea to accomplish this. I have a multithreaded text editor application I made that uses a JTextArea as the main editing area. It's nothing fancy but it was fun to make.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文