简体   繁体   中英

Set the focus on a specified row in jtable

How can I get the focus on a specified row in JTable ie if click on first row, first row will get focused, if I click on second row,second row will get focused and so on...

But I need to get the focus on a specified row ie if I want get the focus on first row, it will only be get focused, the other rows should not be get focus when I clicked on them.

I tried with getTable().requestFocus() and getTable().changeSelection(1, 1, false, false) methods but it's not working.

Can anyone please help me? I am new to Java Swing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM