public void paint(Graphics g) {
   String s = "Applet is open in a separate window.";
   if (!started) s = "Applet is starting.";
   else if (ogf == null) s = "Applet is finished.";
   else if (ogf.useFrame) ogf.triggerShow();
   g.drawString(s, 10, 30);
 }
 void showFrame() {
   if (ogf == null) {
     started = true;
     ogf = new CirSim(this);
     ogf.init();
     repaint();
   }
 }
 public void destroy() {
   if (ogf != null) ogf.dispose();
   ogf = null;
   repaint();
 }
 public void componentResized(ComponentEvent e) {
   if (ogf != null) ogf.componentResized(e);
 }
 public void toggleSwitch(int x) {
   ogf.toggleSwitch(x);
 }
 public static void main(String args[]) {
   ogf = new CirSim(null);
   ogf.init();
 }
 void destroyFrame() {
   if (ogf != null) ogf.dispose();
   ogf = null;
   repaint();
 }