use of com.willwinder.ugs.nbm.visualizer.shared.GcodeRenderer in project Universal-G-Code-Sender by winder.
the class Visualizer2TopComponent method makeWindow.
private GLJPanel makeWindow() {
GLCapabilities glCaps = new GLCapabilities(null);
final GLJPanel p = new GLJPanel(glCaps);
GcodeRenderer renderer = Lookup.getDefault().lookup(GcodeRenderer.class);
if (renderer == null) {
throw new IllegalArgumentException("Failed to access GcodeRenderer.");
}
FPSAnimator animator = new FPSAnimator(p, 15);
this.rih = new RendererInputHandler(renderer, animator, new VisualizerPopupMenu(backend, renderer), backend.getSettings());
Preferences pref = NbPreferences.forModule(VisualizerOptionsPanel.class);
pref.addPreferenceChangeListener(this.rih);
File f = (backend.getProcessedGcodeFile() != null) ? backend.getProcessedGcodeFile() : backend.getGcodeFile();
if (f != null) {
this.rih.setGcodeFile(f.getAbsolutePath());
}
// Install listeners...
backend.addControllerListener(this.rih);
backend.addUGSEventListener(this.rih);
// shutdown hook...
// frame.addWindowListener(this.rih);
// key listener...
p.addKeyListener(this.rih);
// mouse wheel...
p.addMouseWheelListener(this.rih);
// mouse motion...
p.addMouseMotionListener(this.rih);
// mouse...
p.addMouseListener(this.rih);
p.addGLEventListener(renderer);
return p;
}
Aggregations