This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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
 
Similar Threads
small swings problem
Jtable combo box issue
combobox rendered in a Jtable
ComboBox Id
jtable problem please help