PDA

View Full Version : CheckColumnConfig bug please help



baczek00
31 Aug 2012, 11:32 AM
Hi all,

I have this code



CheckColumnConfig checked = new CheckColumnConfig(ColumnDatabaseName,
ColumnName, ColumnSize) {
@Override
protected String getCheckState(ModelData model, String property,
int rowIndex, int colIndex) {
String s = (String) model.get(property).toString();
String r = "";
if (s == "1") {
r = "-on";
} else {
r = "-disabled";
}
MessageBox.info(s + " (Length: "+Integer.toString(s.length())+")", r, null);
return r;
}
};
return checked;
}


Why is my statement "if" shows that the variable "r" is equal to "-disabled" when it is not true as seen in the attached picture?38392

sven
1 Sep 2012, 5:15 AM
if (s == "1") {

This will never be true. Try to change it to "1".equals(s)

baczek00
1 Sep 2012, 6:03 AM
Thank you,
You're right.