Last 2 weeks has been my time revisiting the Java AWT. I was assigned to create a chart graphics which is not supported by existing open source projects. The graphics required to be overlapping with left and right side showing different scales on the Y-axis. I took a look on an open source project that do similar graphics, and finally come into decision to create the graphics itself in Java AWT, and later display it through servlet streaming the image.
Last time I dealt with this stuff was long time ago, first time I learnt Java 1.1. The assignment was to create a GUI application for Reverse Polish Notation (RPN) calculator. RPN is a stack machine, where all operations takes place in the stack. RPN itself was widely used in the first generation programmable calculator (with the first and notable player: Hewlett-Packard!). The assignment was displaying 8 rows of stacked line seven-segment-digits that contain numbers stored in the stack machine.
This is a real fun though, it remains me the time of BASICA when drawing in the screen requires us to compute the coordinate, transforming it, etc. Now of course the AWT has bunch of more satisfying features such as Graphics2D (which wasn't there during Java 1.1 reign).
This is a real banana!
Showing posts with label java2d. Show all posts
Showing posts with label java2d. Show all posts
Monday, October 22, 2007
Tuesday, October 16, 2007
Java2D for Custom Report Graphics Display
This last 4 days I was forced to learn the Java2D. Java2D is a powerful library, but it was only introduced in Java 1.2. The last time I learn about graphics in Java, was the time when I took the OOP Course, back to 1997? Mr. Stef taught us OOP using Java 1.1. AWT has just changed the infrastructure to message based to reduce complexity. We implemented a graphical Reverse Polish Notation calculator with 8 rows representing the contents of the stack (the first electronic calculator was using this kind of stack based Reverse Polish Notation).
Now I have to browse through it again, because the requirements asked for a type of graphics which I believe currently not supported in any reporting engine. It needs an overlapped view of two graphics. One with the legend on the left, and the other on the right. I have tried to use JFreeChart, but eventually found out that this kind of graphics is not commonly used. I have to build the graphics from scratch, except for the encoder that converts the BufferedImage objects into a PNG or GIF files.
It's interesting to see how JFreeChart is doing it down the hood. Last time when I touched this library it was still 0.9.x and not so stable. Now the library has grown up so much, and the page display flashy pictures.
Now I have to browse through it again, because the requirements asked for a type of graphics which I believe currently not supported in any reporting engine. It needs an overlapped view of two graphics. One with the legend on the left, and the other on the right. I have tried to use JFreeChart, but eventually found out that this kind of graphics is not commonly used. I have to build the graphics from scratch, except for the encoder that converts the BufferedImage objects into a PNG or GIF files.
It's interesting to see how JFreeChart is doing it down the hood. Last time when I touched this library it was still 0.9.x and not so stable. Now the library has grown up so much, and the page display flashy pictures.
Subscribe to:
Posts (Atom)