• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with JCombobox

 
djay djay
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a combobox on panel. Also I have a Jbutton 'search'with function key F2
on a dilaog. The panel where combobox is added is added on dialog
I am filling some data into the combobox.
When I select any item from combobox and click on 'search' button
then eveything works fine.
But if instead of clicking on button using mouse if I pressed F2 key
on keyboard i am getting following error message

java.lang.NullPointerException
at javax.swing.JComboBox$DefaultKeySelectionManager.selectionForKey(JComboBox.java:1207)
at javax.swing.JComboBox.selectWithKeyChar(JComboBox.java:1003)
at javax.swing.plaf.basic.BasicComboBoxUI$KeyHandler.keyPressed(BasicComboBoxUI.java:425)
at java.awt.AWTEventMulticaster.keyPressed(AWTEventMulticaster.java:204)
at java.awt.Component.processKeyEvent(Component.java:3761)
at javax.swing.JComponent.processKeyEvent(JComponent.java:2073)
at java.awt.Component.processEvent(Component.java:3637)
at java.awt.Container.processEvent(Container.java:1202)
at java.awt.Component.dispatchEventImpl(Component.java:2678)
at java.awt.Container.dispatchEventImpl(Container.java:1251)
at java.awt.Component.dispatchEvent(Component.java:2581)
at java.awt.LightweightDispatcher.processKeyEvent(Container.java:2200)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2180)
at java.awt.Container.dispatchEventImpl(Container.java:1238)
at java.awt.Window.dispatchEventImpl(Window.java:964)
at java.awt.Component.dispatchEvent(Component.java:2581)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:434)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:141)
at java.awt.Dialog.show(Dialog.java:394)

Any idea to resolve this problem?
 
Craig Wood
Ranch Hand
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic