I have been prompted the solution:
if (image != null) {
item.setIcon(new ImageIcon(getClass().getResource(image)) {
public int getIconHeight() { return 17; }
public int getIconWidth() { return 17; }
});
}
else {
item.setIcon(new ImageIcon("") {
public int getIconHeight() { return 17; }
public int getIconWidth() { return 17; }
});
}