Search in sources :

Example 1 with VisualizerWindow

use of com.willwinder.universalgcodesender.visualizer.VisualizerWindow in project Universal-G-Code-Sender by winder.

the class MainWindow method visualizeButtonActionPerformed.

// GEN-LAST:event_browseButtonActionPerformed
private void visualizeButtonActionPerformed(java.awt.event.ActionEvent evt) {
    // Create new object if it is null.
    if (this.vw == null) {
        this.vw = new VisualizerWindow(settings.getVisualizerWindowSettings());
        final MainWindow mw = this;
        vw.addComponentListener(new ComponentListener() {

            @Override
            public void componentResized(ComponentEvent ce) {
                mw.settings.getVisualizerWindowSettings().height = ce.getComponent().getSize().height;
                mw.settings.getVisualizerWindowSettings().width = ce.getComponent().getSize().width;
            }

            @Override
            public void componentMoved(ComponentEvent ce) {
                mw.settings.getVisualizerWindowSettings().xLocation = ce.getComponent().getLocation().x;
                mw.settings.getVisualizerWindowSettings().yLocation = ce.getComponent().getLocation().y;
            }

            @Override
            public void componentShown(ComponentEvent ce) {
            }

            @Override
            public void componentHidden(ComponentEvent ce) {
            }
        });
        setVisualizerFile();
        // Add listener
        this.backend.addControllerListener(vw);
    }
    // Display the form
    java.awt.EventQueue.invokeLater(new Runnable() {

        @Override
        public void run() {
            vw.setVisible(true);
        }
    });
}
Also used : ComponentListener(java.awt.event.ComponentListener) VisualizerWindow(com.willwinder.universalgcodesender.visualizer.VisualizerWindow) ComponentEvent(java.awt.event.ComponentEvent)

Example 2 with VisualizerWindow

use of com.willwinder.universalgcodesender.visualizer.VisualizerWindow in project Universal-G-Code-Sender by winder.

the class VisualizerCLI method main.

public static void main(String[] args) {
    VisualizerWindow vw = new VisualizerWindow();
    if (args.length > 0) {
        vw.setGcodeFile(args[0]);
    }
    vw.setVisible(true);
}
Also used : VisualizerWindow(com.willwinder.universalgcodesender.visualizer.VisualizerWindow)

Aggregations

VisualizerWindow (com.willwinder.universalgcodesender.visualizer.VisualizerWindow)2 ComponentEvent (java.awt.event.ComponentEvent)1 ComponentListener (java.awt.event.ComponentListener)1