A
Alex Buell
Hi,
I'm learning Java and I'm writing a number base calculator just like the
one in Arachnophilia 5.2. It has four JTextFields, for binary, octal,
decimal, and hexadecimal. The user can enter a number into any of these
four fields and see the converted number in the other fields in real time,
just as they type in the number.
The problem I've run into is that trying to update the other fields often
throws exceptions.
What is the best way to do what I've got in mind?
For example:
User types in 1 in the binary field
Rest of fields gets updated with '1'
User enters a 0 in the binary field
Rest of fields gets updated with '2'
User enters a 1 in the binary field
Rest of fields gets updated with '5'
User enters a 0 in the binary field
Octal field is updated with 12, decimal field is updated with 10, and
hexadecimal field is updated with a.
I've put the source up at
http://www.munted.org.uk/programming/basecalc.java so you can see what I'm
doing wrong.
Thanks for any help, it can only make me a better Java coder!
I'm learning Java and I'm writing a number base calculator just like the
one in Arachnophilia 5.2. It has four JTextFields, for binary, octal,
decimal, and hexadecimal. The user can enter a number into any of these
four fields and see the converted number in the other fields in real time,
just as they type in the number.
The problem I've run into is that trying to update the other fields often
throws exceptions.
What is the best way to do what I've got in mind?
For example:
User types in 1 in the binary field
Rest of fields gets updated with '1'
User enters a 0 in the binary field
Rest of fields gets updated with '2'
User enters a 1 in the binary field
Rest of fields gets updated with '5'
User enters a 0 in the binary field
Octal field is updated with 12, decimal field is updated with 10, and
hexadecimal field is updated with a.
I've put the source up at
http://www.munted.org.uk/programming/basecalc.java so you can see what I'm
doing wrong.
Thanks for any help, it can only make me a better Java coder!