Finally my online calculator is published here: Online Calculator.
I was tired of using Windows Calculator for evaluating terms when I forget my hand calculator at home. And using other numeric bases like hexadecimal were not possible but I needed this functionality quite often. So I decided to code my own expression evaluator as a java applet and to put it on my homepage. Not bad, isn't it? Perhaps you find it also useful ;-)
It took quite some time at the beginning to get a working little parser engine. At first I wanted to do it the 'right way' -to build a complete parser tree in memory but very soon I noticed that this is too much for this little applet and also too time-consuming/complex to code. So I came up with a really simple but good working recursive parser. Then most of the work was already finished - just my ownerdraw resultlist took me some research on the internet to paint the listitems myself.
Originally I wanted also to implement an 'intellisense-like' autocompletion functionality for the textfield where you enter the term. But it turned out to be more difficult that I expect so I delayed it cause my online calculator has till now less than 15 commands so it's more fun than really necessary. But today I continued the fight and got it working - my main idea was not to extend a frame but just a JPopupMenu with some nice 'keylistener-action'. Till now it's not ownerdrawn and I don't know if I should really insert it into my online calculator. Let's see... but first here a little animation that it really works :-)
Thursday, July 03, 2008
Subscribe to:
Posts (Atom)