JFrame に 2 つの JTables と JEditorPane を表示しています。両方のテーブルに異なるデータがあります。table2 をダブルクリックすると、table1 とエディター ペインを更新します。エディター ペインは更新できますが、table1 は更新できません。table1 に e.getClickCount() == 2 を追加しようとしましたが、機能しません。
基本的に、Tabel2 の行 (スレッド番号) をクリックすると、editorPane と table1 がスレッドの詳細で更新されます。これは次のように見えます-
| | 3105 | BOUNDARY_CORE_FCS | 20101216 105754399 | XATransaction::getInstance に入る
doubleClick では、それを editorPane に表示できますが、テーブルで更新することはできません。どんな助けでも大歓迎です。ありがとう。
以下のコードは、table2- の addMouseListener です。
JTable clsNewJTable = new JTable(new RCGUITableModel(arroData, arroHeaders));//... table2
JTable m_clsJTable = RCGUI.m_clsJTable2;// ... table 1
clsNewJTable.addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent e){
if (e.getClickCount() == 2){
JTable clsNewJTable1 = (JTable)e.getSource(); // gets table 2
int rowIndex = clsNewJTable1.getSelectedRow();
int colIndex = clsNewJTable1.getSelectedColumn();
clsNewJTable1.getSelectedRows();
Object strCellValue = clsNewJTable1.getValueAt(rowIndex, colIndex);
doUpdateThreadsInTextArea(strCellValue); // this displays in the jeditorPane
//Should i create the new table1 here?and then update it or adding a new mouselistener to table1 is better?
clsNewJTable1.setVisible(true);
}
}
});