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.