Problem JComboBox Editable getInputMap



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.

.



Relevant Pages

  • JSplitPane and another issue
    ... public class MainPanel extends JPanel implements ActionListener { ... private WebBrowserPane browserPane; ... public void actionPerformed{ ... // Display the window. ...
    (comp.lang.java.gui)
  • JSplit Pane and another issue
    ... public class MainPanel extends JPanel implements ActionListener { ... private WebBrowserPane browserPane; ... public void actionPerformed{ ... // Display the window. ...
    (comp.lang.java.gui)
  • Repaint and Delay Problem
    ... I wrote the following short test applet to try to solve a problem but ... then display a blue letter 'B'. ... red letter 'A' should appear before the delay. ... public void update { ...
    (comp.lang.java.help)
  • Re: Populating a Combo Box dynamically - please Help
    ... JComboBox, use a ListModel or a ComboBoxModel. ... public void valueChanged{ ... public int getSize{ ...
    (comp.lang.java.help)
  • Need Help converting int -> char -> string & TextArea display(!)
    ... display its contents character-by-character ... Please can someone show me how to read each character ... private TextArea inputTextArea; ... public void actionPerformed ...
    (comp.lang.java.help)