Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to get values of other cell if checkbox is selected of the correcponding checkbox in jtable
    primarykey
    data
    text
    <p>how to get values of other cell if checkbox is selected of the correcponding JCheckBox in JTable. I add JCheckbox in JTable</p> <pre><code>JCheckBox checkBox = new javax.swing.JCheckBox(); jTable1 = new javax.swing.JTable(); jTable1.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "Station", "OperationName", "TliScantime", "StartTime", "Completedtime", "TliScanTime-StartTime", "StartTime-CompletedTime", "Select" } ) { Class[] types = new Class [] { java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Boolean.class }; public Class getColumnClass(int columnIndex) { return types [columnIndex]; } }); jTable1.getColumn("Select").setCellEditor(new DefaultCellEditor(checkBox)); jTable1.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); jTable1.getColumnModel().getColumn(0).setPreferredWidth(120); jTable1.getColumnModel().getColumn(1).setPreferredWidth(100); jTable1.getColumnModel().getColumn(2).setPreferredWidth(80); jTable1.getColumnModel().getColumn(3).setPreferredWidth(100); jTable1.getColumnModel().getColumn(4).setPreferredWidth(100); jTable1.getColumnModel().getColumn(5).setPreferredWidth(180); jTable1.getColumnModel().getColumn(6).setPreferredWidth(180); jScrollPane1.setViewportView(jTable1); </code></pre> <p>Now I want to do that when some one click on the JCheckbox it will took the value from <code>TliScanTime-StartTime</code>, <code>StartTime-CompletedTime</code> colum of the selected rows means when JCheckbox is checked. And it will show the average time of <code>TliScanTime-StartTime</code>, <code>StartTime-CompletedTime</code> in the two seperated JLables. And value will be changed dynamically means average time is changed in every click on checkbox.I add checkbox on every rows is creaded. </p> <p>Please give some help with some coding example.thanks in advance</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload