0

Using Database i am showing the Clients Id, Clients Name, Clients IP Address on JTable in Netbeans.Now what i want is before clients id i want to show a check box that each client Info is followed by a check box. But i have no idea of how to add a check box before client id. Kindly help me . My code is

private void HomeActionPerformed(java.awt.event.ActionEvent evt) {                                     
    Connection conn=MySqlConnect.ConnectDB();
    String Sql="Select * from clients";
    DefaultTableModel dm = new DefaultTableModel(0, 0);  
     String s[] = new String[]{"","ClientsId", "Clients Name","Clients IPaddress"};  
     dm.setColumnIdentifiers(s);  
     jTable1.setModel(dm); 
    try
    {
        PreparedStatement pst=conn.prepareStatement(Sql);
        ResultSet rs=pst.executeQuery();




        while(rs.next())
        {
            String str=rs.getString("C_ID");
            String str1=rs.getString("hostname");
            String str2=rs.getString("ipaddress");
            Vector<String> vector = new Vector<String>();
            //I want to show checkbox here 
            vector.add(str);
            vector.add(str1);  
            vector.add(str2);  
            dm.addRow(vector); 
        }

    }
    catch(Exception e)
    {
        JOptionPane.showMessageDialog(null,e);
    } 

    }                                    
zeeshan nisar
  • 553
  • 2
  • 4
  • 18

0 Answers0