JTable keyboard events

Hi.I have a Jtable and i can see that the arrow keys can cycle through the cells of the table.My question is:how can i implement keyboard action, so everytime time a cycle through the cells.Thank you.
[235 byte] By [noe.rochaa] at [2007-11-26 21:26:02]
# 1
If I understood your question correctly then you can use JTable's addKeyListener or add an action thru inputMap and actionMap objects.
Andriuwkoa at 2007-7-10 3:06:36 > top of Java-index,Desktop,Core GUI APIs...
# 2

No idea what you are asking. You say:

> i can see that the arrow keys can cycle through the cells of the table

And then your question is asking:

> so everytime time a cycle through the cells

So you know the keys cycle through the cells and you are asking how to cycle through the cells?

Maybe this posting, which shows how to write an Action for JTable will help:

http://forum.java.sun.com/thread.jspa?forumID=57&threadID=657819

camickra at 2007-7-10 3:06:36 > top of Java-index,Desktop,Core GUI APIs...
# 3
If i click on a cell, then i can cycle through the cells (no poblem here), what i want is to catch the events, like populating text fiels based on the cell i'm navigating.
noe.rochaa at 2007-7-10 3:06:36 > top of Java-index,Desktop,Core GUI APIs...
# 4
So you want to listen to the table's selection model to determine whatcell is selected, maybe?
JayDSa at 2007-7-10 3:06:36 > top of Java-index,Desktop,Core GUI APIs...
# 5

> like populating text fiels based on the cell i'm navigating.

Why does the text change because you select a cell or not? The contents of the cell should remain the same.

If you are talking about showing additional information as the row selection changes then you should be using a SelectionListener.

camickra at 2007-7-10 3:06:36 > top of Java-index,Desktop,Core GUI APIs...
# 6

> > like populating text fiels based on the cell i'm

> navigating.

>

> Why does the text change because you select a cell or

> not? The contents of the cell should remain the

> same.

>

> If you are talking about showing additional

> information as the row selection changes then you

> should be using a SelectionListener.

I don't want to change the content of the cells, i just want to make this test, cycle through the cells using the arrow keys and return in the textfield box the content of that cell, plus the ROW and COL index.

|||-||

|||-|||__Value of the cell here (ROW index, COL index) __|

|||-||

Did i explained myself better now?

Thank you.

noe.rochaa at 2007-7-10 3:06:36 > top of Java-index,Desktop,Core GUI APIs...
# 7
Override the changeSelection(...) method of JTable. You have access to the row and column so you just use getValueAt(...) and populate your text field.
camickra at 2007-7-10 3:06:36 > top of Java-index,Desktop,Core GUI APIs...