Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JAVA source editor

 
Peter Tran
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
Thanks,
-Peter
 
greg philpott
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
check out www.jedit.org
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
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greg,
Thanks. I'll take a look. Amen to Open Source projects.
-Peter
 
Johannes de Jong
tumbleweed
Bartender
Posts: 5089
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic