130131132133134135136137138139140
@Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { HasViewTransform canvas = (HasViewTransform) e.getComponent(); canvas.zoomFit(); } } @Override /**When the 'c' key is pressed, pan so the center of the data is at the center of the screen.
165166167168169170171172173174175
canvas.viewTransform(vt, false); } else if (c == '-' || c == '_') { vt.scale(.5,.5); canvas.viewTransform(vt, false); } else if (c == 'z' || c == 'Z') { canvas.zoomFit(); } } public void mouseEntered(MouseEvent e) {/*Ignored.*/}