MouseEventからJTableの行インデックスを確実に取得する方法は?

StackOverflow https://stackoverflow.com/questions/243553

  •  04-07-2019
  •  | 
  •  

質問

ユーザーがクリックしたJTableの行を調べるにはどうすればよいですか?

役に立ちましたか?

解決

これを試してください:

aJTable.rowAtPoint(evt.getPoint());

他のヒント

JTableでの選択を聞くことだけが必要な場合:

jTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
    public void valueChanged(ListSelectionEvent e) {
        int sel = jTable.getSelectedRow();
    }
});
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top