@Override
public void textValueChanged(final TextEvent e) {
try {
final TextField source = (TextField) e.getSource();
if (scale == source && (scale.isFocusOwner() || bar.isFocusOwner())) {
final double sc = Double.parseDouble(scale.getText()) / 100;
// update both
width.setText(Integer.toString((int) (sc * initial_width + 0.5)));
height.setText(Integer.toString((int) (sc * initial_height + 0.5)));
} else if (width == source && width.isFocusOwner()) {
/*
final int width = Integer.toString((int) (width.getText() + 0.5));
final double sc = width / (double)initial_width;
scale.setText(Integer.toString((int)(sc * 100 + 0.5)));
height.setText(Integer.toString((int)(sc * initial_height + 0.5)));
*/
set(width, height, initial_width, initial_height);
} else if (height == source && height.isFocusOwner()) {
set(height, width, initial_height, initial_width);
}
} catch (final NumberFormatException nfe) {
Utils.logAll("Unparsable number: " + nfe.getMessage());
} catch (final Exception ee) {
IJError.print(ee);
}
}
Display.java 文件源码
java
阅读 34
收藏 0
点赞 0
评论 0
项目:TrakEM2
作者:
评论列表
文章目录