java - JTable with editable checkbox -
The code below is one of my project class. It will produce a frame with Actual class jtable when I click Find button Some data will be loaded into the table dynamically. The last column of the table should be the checkbox with the event. I have tried this code for the checkbox (it is not being taken from any other project ... not working)
DefaultTableModel dtm = New DefaultTableModel (Data, colName) {Public class GetColumnClass (int c) {return (c == 5? Boolean class: string class); }};
public class BookReturnPanel {JPanel retunBookPanel; JTextField txtRegNo; Jebton BTNFind, BTN Save; JTable retunTable = Faucet; Public JScrollPane jScrollPane = null; Private IT; Static object [] [] data; String regNo = null; Member member = null; Default table modell model = new defaultTableModel (); / ** * Create Panel * / Public BookReturnPanel () {} Public JPanel getRetunBookPanel () {if (retunBookPanel == zero) {retunBookPanel = new JPanel (); RetunBookPanel.setLayout (zero); Model.addColumn ("subscribers"); Model.addColumn ("book"); Model.addColumn ("Issue Issue"); Model.addColumn ("Return Date"); Model.addColumn ("The Return"); RetunTable = new JTable (model); RetunTable.setLocation (new point (0, 60)); RetunTable.setSize (new dimension (517, 386)); JLABEL LBLREGNO = new JLABEL ("Member Reg No:"); LblRegNo.setBounds (24, 40, 108, 14); RetunBookPanel.add (lblRegNo); RetunBookPanel.add (getJScrollPane (), border layout.Setter); TxtRegNo = new JTextField (); TxtRegNo.setBounds (12 9, 37, 200, 20); RetunBookPanel.add (txtRegNo); TxtRegNo.setColumns (10); BtnFind = new pocket ("search"); Btnfif.bets (35 9, 36, 91, 23); BtnFind.addActionListener (@ Override Public Voice ActionPerfed (Action Event E) {if (model.getRowCount ()> 0) {for (int i = model.getRowCount () - 1; i & gt; 1; I--) {model.removeRow (i);}} regNo = txtRegNo.getText (); Member = ServiceFactory.getMemberServiceImpl (). FindByregNo (regNo); List & lt; Issue> issues = ServiceFactory.getIssueServiceImpl () .FindAllIssueByMemberId (for members .getSerialNo ()); (Issue Issues: Issues) {Vector
Comments
Post a Comment