Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- JTable: Select next cell on Tab, but first focus selects same cell, not next one
- add_button.addActionListener(new java.awt.event.ActionListener() {
- @Override
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- int row = table_model.addRow();
- table.setRowSelectionInterval(row, row);
- table.scrollRectToVisible(table.getCellRect(row, 0, true));
- table.editCellAt(row, 0);
- table.transferFocus();
- did_add = true;
- }
- });
- table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0, false), "selectNextColumnCell");
- table.setRowSelectionInterval(row, row);
- table.setColumnSelectionInterval(0, 0);
Add Comment
Please, Sign In to add comment