}
private class YTextFieldActionListener implements ActionListener {
@Override
public void actionPerformed(ActionEvent event) {
SubPicture subPic = model.getSubPic();
int y = ToolBox.getInt(view.getYTextFieldText());
if (y == -1) {
y = subPic.getYOffset(); // invalid value -> keep old one
} else if (y < model.getCropOffsetY()) {
y = model.getCropOffsetY();
} else if (y > subPic.getHeight() - subPic.getImageHeight() - model.getCropOffsetY()) {
y = subPic.getHeight() - subPic.getImageHeight() - model.getCropOffsetY();
}
if (y != subPic.getYOffset()) {
model.setEnableSliders(false);
subPic.setOfsY(y);
view.setVerticalSliderValue(subPic.getHeight() - subPic.getYOffset());
view.setPreviewPanelOffsets(subPic.getXOffset(), subPic.getYOffset());
view.repaintPreviewPanel();
setEdited(true);
model.setEnableSliders(true);
}
view.setYTextFieldText(String.valueOf(subPic.getYOffset()));
view.setYTextFieldBackground(OK_BACKGROUND);
}