简体   繁体   English

将焦点设置在jtable中的指定行上

[英]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... 我如何才能将焦点集中在JTable的指定行上,即如果单击第一行,则第一行将被聚焦,如果单击第二行,则第二行将被聚焦,依此类推...

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. 我尝试使用getTable().requestFocus()getTable().changeSelection(1, 1, false, false)方法,但无法正常工作。

Can anyone please help me? 谁能帮帮我吗? I am new to Java Swing. 我是Java Swing的新手。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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