File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes JAVA source editor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "JAVA source editor" Watch "JAVA source editor" New topic

JAVA source editor

Peter Tran

Joined: Jan 02, 2001
Posts: 783
I would like to display some Java source code using a JTextPane. Furthermore, I would like to color-code the JAVA keywords to make it easier to view the source file. My questions are:
1. What's the easiest and most efficient way to parse an entire JAVA source file to find the JAVA keywords (e.g. if, else, while, class, etc.)?
2. Would a JTextPane be the best GUI component to use?
greg philpott
Ranch Hand

Joined: Nov 10, 2000
Posts: 73
check out
Its open source and might save you a lot of work ,and be interesting for you to look at and see how they did it.
Peter Tran

Joined: Jan 02, 2001
Posts: 783
Thanks. I'll take a look. Amen to Open Source projects.
Johannes de Jong

Joined: Jan 27, 2001
Posts: 5089
Peter you might want to look at this as well Modern Compiler Implementation in Java
(edited to fix URL)
[This message has been edited by Cindy Glass (edited September 28, 2001).]
I agree. Here's the link:
subject: JAVA source editor
It's not a secret anymore!