First of all, I apologize for my English neglect that I will explain all my problems.
First I want a JCheckBox in a JTable, which I have.
I am retrieving the student ID and student name from the database in columns with index 0 and 1. I want the third column to be absentee / gift, which will initially accept whether the student is present or missing the JCheckbox value.
Here is my code for JTable values:
Attendance.java
package shreesai; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.Vector; public class Attendance{ Connection con = Connectdatabase.ConnecrDb(); public Vector getEmployee()throws Exception { Vector<Vector<String>> employeeVector = new Vector<Vector<String>>(); PreparedStatement pre = con.prepareStatement("select studentid,name from student"); ResultSet rs = pre.executeQuery(); while(rs.next()) { Vector<String> employee = new Vector<String>(); employee.add(rs.getString(1));
THIS CODE FOR RECEIVING VALUES FROM THE DATABASE, SAVING IT IN A VECTOR
AttendanceGUI.java
package shreesai; import static java.awt.Frame.MAXIMIZED_BOTH; import java.util.Vector; import javax.swing.JOptionPane; public class AttendanceGUI extends javax.swing.JFrame { private Vector<Vector<String>> data; private Vector<String> header; public AttendanceGUI() throws Exception { this.setLocationRelativeTo(null); setExtendedState(MAXIMIZED_BOTH); Attendance att = new Attendance(); data = att.getEmployee(); header = new Vector<String>(); header.add("Student ID"); header.add("Student Name"); header.add("Absent/Present"); initComponents(); } @SuppressWarnings("unchecked")
My problem is that I cannot add a JCheckBox in front of every student I saw as a JTabel model, renderer and everyone, but I get nothing. I want something like this ...

I searched for this material for several weeks, but did the bot something suitable for this.
source share