How do I make the default behaviour of the Enter key map the behaviour of the Tab Key in a JTable?

Sandip Chitale

This depends on which implementation of TableCellEditor interface you are using. If you are using DefaultCellEditor class it depends on the Class of the TableColumn.

Basically you need to know what component is being returned by the -

public Component getTableCellEditorComponent(JTable table,
                                             Object value,
                                             boolean isSelected,
                                             int row,
                                             int column)
In most cases it is JTextField. In that case you could install a new sub KeyMap with the original keymap as the parent. And in the actionPerfomed() do what the tab key does.
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact