private class VerticalSliderChangeListener implements ChangeListener {
@Override
public void stateChanged(ChangeEvent event) {
if (model.isEnableSliders()) {
SubPicture subPic = model.getSubPic();
int y = subPic.getHeight() - view.getVerticalSliderValue();
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()) {
subPic.setOfsY(y);
view.setYTextFieldText(String.valueOf(subPic.getYOffset()));
view.setPreviewPanelOffsets(subPic.getXOffset(), subPic.getYOffset());
view.setPreviewPanelAspectRatio(21.0 / 9);
view.repaintPreviewPanel();
setEdited(true);
}
}