Formatted code display

H’lo everyone! It’s been quite a while since I’ve been around; university has been quite a hectic ride. So, what type of programmer would I be if I didn’t return with something cool to show everyone?

As the subject implies, I’ve written a PHP script that formats, colours and prints Java code. It has a companion script that lists all the files in a directory and links them to the formatter. You can check out a working example here.

What does this have to do with jME?

It has a jME-specific feature: any import statements that refer to jME classes are linked to the formatter. So you can click on the import statement and have the source of that class also displayed using the formatter. Imports of entire packages are linked to the directory listing script.

Documentation: Having the jME sources available - and formatted - online is another form of documentation in addition to the Javadocs. It’s a quick reference for people who might not have the sources immediately available offline.

Demos: One idea I had is to link to the source code of the demos

in addition to having the description and Webstart. Prospective users could then see how easy it is to acheive complicated effects in jME. Also, through the import statement links, the user could get a feel for jME’s implementation. It could also makes it easier for new users to find examples of how to initialize and use jME.

So, what do you think?

Hey Eric,

Looks great. I like the rendering of the text. That’d be great to link to the test source from each demo link. We’ll definately have to look into doing that shortly.

Glad you like it!

I’ve been working with Mambo recently, and it strikes me that it should be reasonably simple to implement. The script should take care of itself it we simply modify the demo page to include the correct links.

(On a somewhat related note, I’ve also been designing templates for Mambo. If anyone wants to provide a new jME site design, I could code it up. As much as I like the Mambo default templates, I think it’d be cool if we had something unique.)

I like it

You could probably do the same for most other import statements by linking standard java class imports to their sun source.