this is my code:
tableModel = new DefaultTableModel( new Object[][] {}, columnNames);
table = new JTable(tableModel){
public Class getColumnClass(int column)
{
return getValueAt(0, column).getClass();
}
};
table.setPreferredScrollableViewportSize(new Dimension(500, 70));
table.setRowHeight(25);
table.setFocusable(false);
int vColIndex = 1;
TableColumn col = table.getColumnModel().getColumn(vColIndex);
col.setCellEditor(new MyComboBoxEditor(values));
col.setCellRenderer(new MyComboBoxRenderer(values));
now I add to my code:
table.addKeyListener(new KeyAdapter()
{
public void keyReleased(KeyEvent e)
{
if(e.getKeyCode() == KeyEvent.VK_TAB)
{
System.out.println("work");
}
}
});
but when I push TAB don't obtain any result....I do not why...
Works fine for me.
If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program[/url] (SSCCE) that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
Don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags[/url] so the posted code retains its original formatting.