Hi all,
i wan to make a JTable with JRadioButon such that one or two cells will not have any JRadio Button depending upon value I get from Database. When same code is run with Metal look and feel it works..but with Nimbus it does not.. If getValueAt() method returns null I get NullPointerException... I tried to change the code..(basic code i got after googling)
Please see the code:
when I run this code I get NullPointerException if return(Object)new JRadioButton("NoData"); is removed from method public Object getValueAt(int row, int col). The NullPointerException is removed by adding line return(Object)new JRadioButton("NoData"); in the code but it makes a JRadioButton in the table with lable No data..What I want is the cellshould not have any value at all..
I changed the code of public Object getValueAt(int row, int col). to
where useLessobj is an object created earlier..But it gives me ClassCastException in
public Component getTableCellRendererComponent(
JTable table, Object value,boolean isSelected, boolean hasFocus, int row, int column)
{
if (value==null) return null;
return (Component)value;
}
}
I tried returning a JLable from getTableCellRendererComponent method but again ClassCastException is what i get.
Please suggest correct way of doing this..