JTable questions

N

news.otenet.gr

I have a table with 5 columns.
1. How can I move the focus to cell in 5th col, 1st row?
2. How can I disallow the move of focus to a column different than 5th?
 
R

Roedy Green

1. How can I move the focus to cell in 5th col, 1st row?

This is complicated slightly by the fact there are NO components
hiding behind each cell. You use the same component to paint all the
bits for all the cells in a column.

Lets presume you can deal with scrolling so that you can figure out
the row/col you want either in the model or relative to the top of
window currently scrolled on screen.

I don't see any methods for setting focus, but there is the
SelectionModel. Perhaps if you select the row, it will get focus.
 
R

Roedy Green

1. How can I move the focus to cell in 5th col, 1st row?

I have been thinking about your problem.

Here are some ways you might tackle it.

1. look at all the code in the JTable components and see how focus is
handled.

2. Monitor the events that appear at JTable when you give focus to a
cell.

3. create a synthetic event to give focus to the cell in question.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top