• Post Reply Bookmark Topic Watch Topic
  • New Topic

Anyone for this ?  RSS feed

 
Meghna Prasad
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
class SymKey extends java.awt.event.KeyAdapter
{
public void keyTyped(java.awt.event.KeyEvent event)
{
Object object = event.getSource();
if (object == JComboBox1)
JComboBox1_keyTyped(event);
}
}
void JComboBox1_keyTyped(java.awt.event.KeyEvent event)
{
System.out.println("KeyTyped");
}
 
Vinod Venugopal
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What du want to do exactly Meghna? Du want to implement an editable ComboBox?
'Cos if u use combo.getSelectedItem().toString() it givesu whatver is ther in the combo?
Or du have any more specfications?
Vinod
 
Meghna Prasad
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was trying to capture the keyevent for the ComboBox, but it is not reacting to the KeyTyped Event. Just wanted to know if KeyListeners work for JComboBoxes.
Thanks
Meghna
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!