117118119120121122123124
final AggregatingDisplay panel = new AggregatingDisplay(aggregator, transfer, dataset, r); frame2.add(panel, BorderLayout.CENTER); frame2.setVisible(true); frame2.revalidate(); frame2.validate(); SwingUtilities.invokeAndWait(new Runnable() {public void run() {panel.zoomFit();}}); } }
6263646566676869707172
frame.setLayout(new BorderLayout()); frame.add(p, BorderLayout.CENTER); frame.setSize(500, 500); frame.invalidate(); p.zoomFit(); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }
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.*/}
112113114115116117118119120121122
final ARComponent.Aggregating img = display; try { SwingUtilities.invokeAndWait( new Runnable() { public void run() { img.zoomFit(); img.renderAgain(); } } ); } catch (InvocationTargetException | InterruptedException e1) {}