I wanted to provide an easy to use interface in my latest program. At times I put up a dialog where the user must choose a value. I want the user to be able to just press one key to make the choice. Initially I tried using the JOptionPane. But it required the user to press enter after making the choice.
I thought I needed to somehow specify an option (no pun intended) for the JOptionPane to just require a keypress. After a while, it felt like I was hacking to much to get this to work. I seemed to need to set some weird user interface options, then set up some maps, and I was still struggling to figure out which key got pressed.
Then I researched some mneumonics. Turns out those require you to press the Alt key along with the choice you make. No good. Finally I figured I needed some custom code. I forgot about the canned JOptionPane and started concentrating on a straight JDialog. Got an assist from the Java2s web site. A map plus a listener was all I needed. Now I am going back to the basics of drawing some user choices on the dialog. That should be a snap. I wish I knew to go straight to the JDialog in the first place. I been spending most of the day on this issue.
Free Laundry
-
Apparently a lot of apartment buildings have coin operated laundry machines
in the basement. And guess what? You can order a key to unlock the payment
me...
5 years ago