Hello
I'm having problem with selecting rows in my JTable with mouse clicks. I can
create my own model and renderers for certain types but I don't know where I
can find select operations.
What I'd like to do is:
I click on cell A, it's ready for editing (goes into CellEditor), then I
click on cell B and it instantly goes into the editing mode as well (leaving
cell A not selected of course)
What I have now:
I click on cell A, it's ready for editing, then I click on cell B, cell A
loses it's focus (goes out of the editing mode) and I have to click ONE MORE
TIME to get into B.
I'd like to thank you in advance for any kind of clue with JTable.
R.Bielec
Vincent Vollers - 22 Dec 2003 12:10 GMT
> Hello
> I'm having problem with selecting rows in my JTable with mouse clicks. I can
[quoted text clipped - 10 lines]
> I'd like to thank you in advance for any kind of clue with JTable.
> R.Bielec
I believe this should work:
table.addMouseListener(
new MouseListener() {
public void mouseClicked(MouseEvent e) {
Point p = e.getPoint();
int row = table.rowAtPoint(p);
int column = table.columnAtPoint(p);
if(table.isEditing()) {
table.removeEditor();
}
table.editCellAt(
row,
column);
}
public void mousePressed(MouseEvent arg0) {}
public void mouseReleased(MouseEvent arg0) {}
public void mouseEntered(MouseEvent arg0) {}
public void mouseExited(MouseEvent arg0) {}
}
);
Regards,
- Vincent
Rafal Bielec - 24 Dec 2003 17:59 GMT
> Regards,
> - Vincent
THX :]