0

I would like to create a sort of drop down list (JComboBox?) that will look/act like a JButton. That is when the item is selected it will close the dialog and act on the selection. I have a vague idea how to accomplish this with a MouseListener but I can't completely see the whole picture. I'm not even sure if a MouseListener is the right approach. I could create a different JButton for each delay but I'm wondering if there is a more elegant way.

The purpose of the JDialog is to ask the user to have the application take a certain action immediately or re-prompt for that action after 5, 10 or 15 minutes. Many applications I've used, such as software updates that might require a reboot, have such a "button" to re-prompt after some specific time selected via the "button."

I would appreciate any ideas on how to accomplish this, if possible.

Wt Riker
  • 514
  • 12
  • 24
  • Possible duplicate of [JComboBox Selection Change Listener?](http://stackoverflow.com/questions/58939/jcombobox-selection-change-listener) – Frakcool Dec 06 '16 at 14:04
  • Just to clarify, I know how to code the various actions I just don't have a clear idea how to make the GUI look right. – Wt Riker Dec 06 '16 at 14:23
  • Then clarify your question, and post a valid [mcve] *"I just don't have a clear idea how to make the GUI look right"* what you mean by "right"? – Frakcool Dec 06 '16 at 14:25
  • Why does the drop down menu has to look like different buttons? – SedJ601 Dec 06 '16 at 14:28
  • From what I understand OP wants to do something when user selects a value from the combo, so an action / item listener works fine, if you want to make the combo look like a button then, that's something different – Frakcool Dec 06 '16 at 14:44
  • I'm a programmer not a designer (no creative talent). Perhaps I am asking the wrong way. A normal JComboBox, to a user, generally indicates a selection but does nothing beyond that, visible to the user, until some other action is taken (a save button or something). I want it to be obvious that when the user makes a selection it will act, to the user, as a button that will dismiss the dialog and take the selected action. By "look right" I mean that its appearance is distinguishable as something other than a normal JComboBox. – Wt Riker Dec 06 '16 at 15:06

0 Answers0