Controlled editing of a row selection in JTable

前端 未结 2 945
没有蜡笔的小新
没有蜡笔的小新 2020-12-11 23:41

I have a JTable displaying rows from an SQL database. The table is relatively small (only 4 columns and up to 1000 rows).

I would like to give the user the opportun

2条回答
  •  南笙
    南笙 (楼主)
    2020-12-11 23:52

    The behaviour you mention can be achieved by forcing your table to start editing again.

    First make sure you now yourRow and Column and that you add your own tablecelleditor that extands from the AbstractCellEditor then add this to your stopCellEditing method:

    EventQueue.invokeLater(new Runnable()
        {
    
          public void run()
          {
            yourTable.editCellAt( yourRow, yourColumn+1);
          }
        });
    

提交回复
热议问题