| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| Java Programming Ask your Java programming question and help out others with theirs. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
How can I set the focus of a JTable cell?
Can someone explain how to set the focus to one cell in a JTable? I have looked everywhere for this answer, and not found it yet. Please Help..
--Dave |
|
#2
|
|||
|
|||
|
Re: How can I set the focus of a JTable cell?
jtable.setColumnSelectionInterval(0,0);
jtable.setRowSelectionInterval(0,0); This will focus Cell(0,0) |
|
#3
|
|||
|
|||
|
Re: How can I set the focus of a JTable cell?
Please help me how to focus a particular cell in a jTable. (For ex: cell(3,2) ). After validating a cell on focus out, I want to get back to the same cell.
I have tried with the below code: jtable.setColumnSelectionInterval(0,0); jtable.setRowSelectionInterval(0,0);" But it dint work.... Kindly help me in this issue. |
|
#4
|
|||
|
|||
|
Re: How can I set the focus of a JTable cell?
Apologies for the delay...
If you want only a single cell focused, make sure you have cell selection enabled, then select the required cell and give the table focus. The cell won't be focused unless the table is given focus: Code:
table.setCellSelectionEnabled(true); ... table.changeSelection(row, column, false, false); table.requestFocus(); John Ousterhout
__________________
Please use [CODE]...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present. |
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|