Problem JComboBox Editable getInputMap
- From: "Badshah" <Surti.Sohail@xxxxxxxxx>
- Date: 24 Feb 2007 00:47:56 -0800
Hello Friends, I have some problem . I am using JComboBox. I have used
getInputMap() on the JComboBox. The problem is that :
---------------------------This code works after the combobox is
editable---------------------------------
getInputMap(WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"),"Process");
getActionMap().put("Process",new AbstractAction("Process")
{
public void actionPerformed(ActionEvent evt)
{
switch (mode)
{
case ADDITION:
System.out.println("Addition");
break;
case MODIFICATION :
System.out.println("Modification");
break;
case DELETION :
System.out.println("Deletion");
break;
case DISPLAY :
System.out.println("Display");
break;
}
}
}
);
---------------Where as This code does not work after the combobox is
editable------------------
getInputMap(WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ENTER"),"Process");
getActionMap().put("Process",new AbstractAction("Process")
{
public void actionPerformed(ActionEvent evt)
{
switch (mode)
{
case ADDITION:
System.out.println("Addition");
break;
case MODIFICATION :
System.out.println("Modification");
break;
case DELETION :
System.out.println("Deletion");
break;
case DISPLAY :
System.out.println("Display");
break;
}
}
}
);
only the difference is of the Key. i.e. ENTER & ESCAPE.
.
- Prev by Date: Re: Displaying Images
- Next by Date: TrayIcon with PopupMenu or JPopupMenu ?
- Previous by thread: Removing "All Files" option from FileType of JFileChooser
- Next by thread: TrayIcon with PopupMenu or JPopupMenu ?
- Index(es):
Relevant Pages
|