wood burning stoves*
The moose likes Swing / AWT / SWT and the fly likes combobox ,how to get it from Table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "combobox ,how to get it from Table" Watch "combobox ,how to get it from Table" New topic
Author

combobox ,how to get it from Table

Arun Sanker
Ranch Hand

Joined: Mar 21, 2007
Posts: 44
Hi guys,

Have a table ,in which Iam rendering a column to display as combobox while editing.
Iam doing it as follows.

// These are the combobox values
String[] values = new String[]{"item1", "item2", "item3"};
JComboBox comboBox = new JComboBox(values);
comboBox.setEditable(true);
sheetColumn.setCellEditor(new DefaultCellEditor(comboBox));

//sheetColumn is a column in my table(1st column).



Which component should I get from the table,to add the keyListener to it & how will I get this component from the table?.


Have added a listener as follows:

X" .addKeyListener(new KeyAdapter(){

public void keyTyped(KeyEvent e){
char c = e.getKeyChar();


})
}

Thanks...
Arun Sanker
Ranch Hand

Joined: Mar 21, 2007
Posts: 44
It worked when I did

combobox.getEditor().getEditorComponent().addKeyListener(new KeyAdapter()
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: combobox ,how to get it from Table