I am supposed to write a program that converts kilometers to miles and vice versa. We are only supposed to use JOptionPane for this assignment. I am wondering if it is possible to customize the buttons in JOptionPane and associate a formula to those buttons.
For instance, I want to have the text field and then two buttons that read "Miles" and "Kilometers". If you click on Miles, it will convert the number entered to miles.
I have researched quite a bit, but I can't seem to find a definitive answer. Any help would be greatly appreciated.

9 Years
Discussion Span
Last Post by stephen84s

how else were you thinking of doing this? of course you can do what you have explained. imagine if buttons didn't have "custom" events...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.