public void init() {
        if (!runOnCanvas) {
            final BufferedImage bi = new BufferedImage(2, 2, BufferedImage.TYPE_INT_ARGB);
            cs.handleResize();
            cs.needAnalyze();
            cs.updateCircuit(bi.getGraphics());
//            cs.analyzeCircuit();
            updateThread = new Thread("HiddenCircuitSim" + Thread.activeCount() + 1) {
                @Override
                public void run() {
                    while (true) {
                        try {
                            if (kill || cs.isDisabled()) {
                                return;
                            }
                            Thread.sleep(sleep);
                            if (!cs.isStopped()) {
                                cs.updateCircuit(bi.getGraphics());
                            } else {
                                Thread.sleep(50);
                            }
                        } catch (Exception ex) {
                            System.out.println(this);
                            ex.printStackTrace();
                        }
                    }
                }
            };
            updateThread.start();

            if (debugFrame) {
                JFrame f = new JFrame();
                f.getContentPane().add(new JPanel() {
                    {
                        new Thread() {
                            @Override
                            public void run() {
                                while (true) {
                                    try {
                                        Thread.sleep(10);
                                    } catch (InterruptedException ex) {
                                    }
                                    repaint();
                                }
                            }
                        }.start();
                    }

                    @Override
                    public void paintComponent(Graphics g) {
                        g.drawImage(bi, 0, 0, null);
                    }
                });
                f.setSize(new Dimension(300, 300));
                f.setVisible(true);
            }
        }
    }