带语法高亮和行号的文本编辑器? [英] Text editor with syntax highlighting and line numbers?

查看:458
本文介绍了带语法高亮和行号的文本编辑器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这甚至可能对团队项目来说有点挑战,更不用说单人实现了,但我试图用语法高亮来组合一个简单而优雅的文本编辑器,使用 JEditorPane 。我偶然发现 这个 已经停止使用,我很难理解所有lexer文件和里面的.lex东西。我甚至在一些博客中发现这个项目后来被其他一些团队采用,但甚至还没有停止。我不需要它太过花哨,比如有代码折叠和东西(尽管我很想知道如何做到这一点),但我至少需要基本语法高亮才能存在就像Notepad ++一样,最左边的行号就差不多了。请记住,至少目前我只需要它来突出显示Java源代码。

This is a bit challenging even probably for a team project, let alone for a one-man implementation, but I was trying to put together a simple yet elegant text editor with syntax highlighting, using a JEditorPane. I stumbled upon this which was discontinued and really hard for me to understand with all the lexer files and .lex stuff inside. I even found in some blog that this project was later taken on by some other team but even yet again discontinued. I don't need it to be too fancy, like having code folding and stuff (even though I am tempted to find out how to do this), but I need at least a basic syntax highlighting to exist and pretty much line numbers on the far left side just like Notepad++ for example. Keep in mind that I only need it to highlight Java source-code, at least for now.

我正在寻找的是一个教程,一个记录良好的例子和示例代码,一个预先制作的包,甚至NetBeans的工具都可以做到这一点,我不需要从头开始编写源代码,我只需要一个可以使用的实现。提前致谢!

What I am looking for is either a tutorial, a well-documented example and sample code, a pre-made package, even a tool for NetBeans can do the trick, I do not neccesarily need the source code written from scratch, I just need an implementation that can be of use. Thanks in advance!

PST这不会是商业化的,也不会太大,当有那么多编程编辑器时,不要问我为什么要重新发明轮子,我正在学习,这对我来说是一个很好的练习!

P.S.This is not gonna be commercial or too big, don't ask why I want to reinvent the wheel when there are so many programming editors out there, I am learning and this came up as a nice exercise for me!

推荐答案

RSyntaxTextArea 获得BSD许可,并支持您的要求,以及代码折叠等。使用非常简单。

RSyntaxTextArea is BSD licensed and supports your requirements, plus code folding and more. Very simple to use.

这篇关于带语法高亮和行号的文本编辑器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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