要在JTable里加入事件,使得在Label中显示所选择的单元格里面的值。
现在就是不知道需要加入什么事件。

解决方案 »

  1.   

    label.caption  vb是这样呵呵
      

  2.   

    其实这不是JLable的事件,而已其它的对象,只是给JLable赋值JLable.text
      

  3.   

    class M1 extends MouseAdapter
    {
    public void mousePressed(MouseEvent e)
            {
                int col = table.getSelectedColumn();
                int row = table.getSelectedRow();            if(col == 0 && row >= 0)
                 modeDataItem data = (modeDataItem)(table.getModel().getValueAt(row,col));
            }
    }
      

  4.   

    table.getSelectionModel().addListSelectionListener(ListSelectionListener);