private JTable getTRent() {
if (tRent == null) { ...
tRent.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent arg0) {
tDescription.setText(house.getDescripcionMansion(tRent.getSelectedRow()));
image.setIcon(new ImageIcon(BookWindow.class.getResource(
"/images/" + house.getCodeMansion(tRent.getSelectedRow()) + ".png")));
String childrenAllowed = house.getChildrenAllowed(tRent.getSelectedRow());
if (childrenAllowed == "N"){
txKids.setEditable(false);
cbBookHouse.setEnabled(true);
}
}
});
}
return tRent;
}
The problem that I'm having with the previous code is that any condition, apart from the image, is accomplished, seems to be ignored.
I just checked if the value was read correctly and it is, with a println
in console, I get a N or Y depending on the row, but if I check that value, nothing happens with the components I want its state to be changed.
Also tried to put those conditions inside the components and the same happens.
The code of the methods getChildrenAllowed()
for example, is like this
public String getChildrenAllowed(int index) {
return houseRelation.get(index).getChildren();
}