JTable Default Selection Problem!!
hi all,
i m creating one small appplication in which i have to display select content of JTable.
i create one defaulttable model and give refrence in JTable
and get selected item from ListSelectionModel.
bt i m facing one problem it gives me default value means when no Row is selected it give 1st Row as selected so how to solve this problem.....
i m giving u code to show me my mistake......
tab.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
if (ALLOW_ROW_SELECTION==false)
{// true by default
ListSelectionModel rowSM = tab.getSelectionModel();
rowSM.addListSelectionListener(new ListSelectionListener()
{
publicvoid valueChanged(ListSelectionEvent e)
{
//Ignore extra messages.
if (e.getValueIsAdjusting())return;
lsm = (ListSelectionModel)e.getSource();
if (lsm.isSelectionEmpty()){
JOptionPane.showMessageDialog(con,"SELECT CERTIFICATE!!!");
}else{
selectedRow = lsm.getMinSelectionIndex();
}
}
});
}else{
tab.setRowSelectionAllowed(false);
}

