I have created a jTable class which is used with another class. Here the code:
public class Data_Table extends JFrame{
DefaultTableModel dtm;
JTable table;
JScrollPane scrollPane;
JFrame ventana;
JButton button1,button2;
JPanel pCentral,pSouth,pWindow;
public void init() {
String[] columnNames = {"CBD","abstract","final","native","private","protected","public",
"static","strictfp","synchronized","transient","volatile"};
dtm = new DefaultTableModel(columnNames,0);
table = new JTable(dtm);
scrollPane = new JScrollPane(table);
button1 = new JButton("Ok");
button2 = new JButton("Cancel");
}
public void addData(Object[] data) {
dtm.addRow(data);
}
public void createWindow() {
pCentral=new JPanel();
pCentral.add(scrollPane);
pSouth=new JPanel();
pSouth.add(button1);
pSouth.add(button2);
pWindow=new JPanel(new BorderLayout());
pWindow.add(pCentral,BorderLayout.CENTER);
pWindow.add(pSouth,BorderLayout.SOUTH);
ventana=new JFrame("");
ventana.setContentPane(pWindow);
ventana.add(scrollPane);
ventana.setSize(1000,200);
ventana.setLocationRelativeTo(null);
ventana.setVisible(true);
}
}
I want to transform the columns from abstract
to volatile
into jCheckBox. The result right now is this:
How can I transform my table???