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.
ntredame
0
Newbie Poster
Recommended Answers
Jump to PostUsing 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.
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.