Home | Travaux STAF | STAF2x - Report for exercise 4 (Java Swing) STAF-E


"Vivian's polynomial plotter"


The Scenario
Technical details-problems
References - Bibliography

This is an exercise I did totally by chance :) I actually wanted to do something with EAI (External Authoring Interface). But, as I have Linux at home, I faced many difficulties to run VRML mostly form my machine. After spending hours on the web to find a descent VRML plugin, I realised that VRwave, VRweb and all the rest seemed far away from the ones that exist for Windows. Considering that I had already spent quite some time to find a good idea to implement, I stopped for a while and thought seriously to change my mind and do something else. And that's exactly what I did...

The only thing that I hadn't done yet, was Swing. Adding to it, that it is Hip :) and people like applets, I thought what the hell, let's have fun! Actually, I already had an idea of putting some swing components inside the project management of staf18 (mostly a progress bar). So, it was a very good opportunity to play with Swing and exercise myself.

Of course, like always, I started again looking for a good idea that can be also educative, like all my exercises for this diploma. Trying to figure out what could be graphic and also serious and educative and I came out with : graphs! The idea of implementing something that has to do with maths (how original for me :) seemed so perfectly nice that I started immediately.

I decided to make an applet from which a web surfer (hopefully a high school student) could manipulate some swing components, form a function and watch it's graph and how it changes by adjusting the coefficients of x.

As a conclusion, I strongly believe that this application can be a very educative tool for polynomial graphs. In my case, that I take a second degree polynomial, someone can immediately move only one slider and watch that:


The scenario
My swing components are:

Function dynamic field:

The user can create his own function by adjusting the three sliders that follow.


Possibility to adjust the X, Y minima and maxima for the function and immediately the canvas re-adjusts to the new data.


Three sliders - each for a co-efficint - through ehich the user modifies the function.


Current graph is being showed inside canvas. The axis X and Y are always adjusted to the limits.


Technical details - problems
First problem was with VRML that there are no descent plugins for Linux. And the ones that exist are complicated to install with many problems.

With Swing now, one of the problems I had, was calculations with Java. In the beginning I wanted to make the plotter for five degree polynomials or even let the user to choose the degree, but I realised that it was an utopy. Even diminishing the degree to number three, I still have problems because Java is getting crazy every time that I choose some bigger numbers for limits or coefficients.

Another problem, that I face, is that my applet doesn't work as well as my application. With appletviewer works perfectly well, but as long as I change the main() method to init() for the applet, only the graph changes and the rest change only if I reload the page!

I would like to note down some details:


References - Bibliography - Sites


©Vivian Synteta
Last modified 13/06/2000
Back to Travaux page