}
});
roiVisibilityBoxes[i].setBackground(roiColor);
final int index = i;
startTextFields[i] = new ErrorTextField("0");
startTextFields[i].setErrorColor(getBackground());
final int startTextFieldsIndex = i;
startTextFields[i].addKeyListener(new KeyListener() {
@Override
public void keyPressed(KeyEvent e) {
// nothing to do
}
@Override
public void keyReleased(KeyEvent e) {
try {
Double.parseDouble(startTextFields[startTextFieldsIndex].getText());
} catch (NumberFormatException e1) {
startTextFields[startTextFieldsIndex].setBackground(VALUE_ERROR_COLOR);
}
}
@Override
public void keyTyped(KeyEvent e) {
// nothing to do
}
});
startTextFields[i].getDocument().addDocumentListener(new DocumentListener() {
@Override
public void changedUpdate(DocumentEvent e) {
enableSetRoi(startTextFields[index]);
}
@Override
public void insertUpdate(DocumentEvent e) {
enableSetRoi(startTextFields[index]);
}
@Override
public void removeUpdate(DocumentEvent e) {
enableSetRoi(startTextFields[index]);
}
});
endTextFields[i] = new ErrorTextField("0");
endTextFields[i].setErrorColor(getBackground());
final int endTextFieldsIndex = i;
endTextFields[i].addKeyListener(new KeyListener() {
@Override