Пример #1
0
  public static void convertEquationToCircuit() {
    String eq = JOptionPane.showInputDialog(MDIWindow.getDrawingPad(), "Enter Equation");
    if (eq == null) return;
    EquationCircuit eq_cir = new EquationCircuit();

    DigitalCircuit cir = eq_cir.convert(eq);
    MDIWindow.getDrawingPad().setCircuit(cir);
  }
Пример #2
0
  /*
   * (non-Javadoc)
   *
   * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
   */
  public void actionPerformed(ActionEvent e) {
    FileReader fr = null;
    try {

      DigitalCircuit cir;
      fr = new FileReader("temp-cir.xml");
      cir = (DigitalCircuit) st.fromXML(fr);

      DigitalWindow win = new DigitalWindow(); // create a new window
      DrawingPad pad = win.getDrawingPad();
      pad.setCircuit(cir);

      MDIWindow.addWindow(win);
      win.show();

      fr.close();
    } catch (FileNotFoundException e1) {
      e1.printStackTrace();
    } catch (IOException e1) {
      e1.printStackTrace();
    } catch (Exception e1) {
      try {
        fr.close();
      } catch (IOException e2) {
        // TODO Auto-generated catch block
        e2.printStackTrace();
      }
    }
  }
Пример #3
0
 public static DigitalShape getComp(Point p) {
   return MDIWindow.getDrawingPad().getCircuit().find(p);
 }