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.

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...

Using the showOptionDialog() from the JOptionPane class, you should be able to achieve that. As JOptionPane in the "showOptionDialog()"does allow you to add your own custom components.