• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1238
  • Last Modified:

How to open/display JComboBox programmatically..

Hello,

I want to open a JCombox in runtime, if users presses Shift+F1. The necessary coding for key listeners is done. However I dont know how to open the combobox from the code..

Do you know whether it is possible or not?


Thanks for the answers..
0
serdarulutas
Asked:
serdarulutas
  • 4
  • 4
2 Solutions
 
zzynxSoftware engineerCommented:
call showPopup()
0
 
zzynxSoftware engineerCommented:
It causes the combo box to display its popup window
0
 
CEHJCommented:
component.getInputMap().put(KeyStroke.getKeyStroke("shift F1"), "showCombo");

component.getActionMap().put("showCombo", new ShowComboAction());
...
// inner class
class ShowComboAction extends AbstractAction {
      public void actionPerformed(ActionEvent e) {
            combo.showPopup()
      }
}      
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
serdarulutasAuthor Commented:
Thanks.
0
 
CEHJCommented:
:-)
0
 
zzynxSoftware engineerCommented:
Thanks for accepting.

Don't find that CEHJ's comment deserves any points.
Since you said that
>> The necessary coding for key listeners is done
it doesn't do anything more than just repeating what I posted 7 minutes before.

What do you say CEHJ?
0
 
CEHJCommented:
KeyListener is, if not deprecated, obsolescent. My code shows how to do it with Swing
0
 
zzynxSoftware engineerCommented:
>> KeyListener is, if not deprecated, obsolescent.
Who says that?
>> My code shows how to do it with Swing
That was not asked

But OK..........

0
 
CEHJCommented:
>>Who says that?

KeyListener is AWT legacy - and no - i'm not going to scour the web for supporting quotes ;-)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now