Click here to Skip to main content
15,886,724 members

Comments by Member 12712527 (Top 200 by date)

Member 12712527 13-Mar-23 7:47am View    
Run debugger but can't find the error. while debugging the file showed nullq instead of q. where is the error i can't find. just after sc1.hasnextline() the nullq is shown as if it was previously inserted in the file.but on seeing the file only q is inserted and the next value is 1 but shown null while running the program
Member 12712527 24-Feb-23 6:12am View    
class chkBoxTableCellRenderer extends DefaultTableCellRenderer
{

@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
JCheckBox chk=new JCheckBox();
if(DefaultValue.strValue=="True")
{

chk.setSelected(true);
return chk;
}
else
{
chk.setSelected(false);
return chk;
}
}

}
in Data.java
for(int k=0;k
Member 12712527 21-Feb-23 3:47am View    
OKay thank you sir I got it. It was a silly mistake of 'boolean' and 'Boolean'
Member 12712527 21-Feb-23 3:41am View    
I have already a table with the following datatypes[int,double,string....]
how could i add this to my table
Member 12712527 21-Feb-23 3:37am View    
why do you need checkbox...see the code below

public class jt_jc extends JFrame
{
private JTable table;
private DefaultTableModel model;
public JTable_JCheckBox() {
Random rnd = new Random();
model = new DefaultTableModel(new Object[]{"Check Box1","Check Box2", "Check Box3"}, 0) {
@Override
public Class getColumnClass(int columnIndex) {
return Boolean.class;
}
};
for (int index = 0; index < 10; index++) {
model.addRow(new Object[]{rnd.nextBoolean()});
}
table = new JTable(model);
add(new JScrollPane(table));
setTitle("JCheckBoxJTable Test");
setSize(375, 250);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setVisible(true);
}