/**
   * Aware-P Epanet application entry point
   *
   * @param args
   * @throws UnsupportedLookAndFeelException
   */
  public static void main(String[] args) throws UnsupportedLookAndFeelException {
    if (Utilities.isMac()) {
      System.setProperty("apple.laf.useScreenMenuBar", "true");
      System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Aware-P Epanet");

      Application app = Application.getApplication();
      app.setDockIconImage(
          Toolkit.getDefaultToolkit().getImage(EpanetUI.class.getResource("/uiresources/ae.png")));

      JMenuBar menuBar = new JMenuBar();
      JMenu fileMenu = new JMenu("File");
      menuBar.add(fileMenu);

      openAction = new JMenuItem("Open");
      saveAction = new JMenuItem("Save");
      runAction = new JMenuItem("Run");

      fileMenu.add(openAction);
      fileMenu.add(saveAction);
      fileMenu.add(runAction);
      app.setDefaultMenuBar(menuBar);
    }
    UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
    new EpanetUI();
  }
  /** Aware-P Epanet frontend constructor. */
  public EpanetUI() {
    initLogger();

    frame = new JFrame();
    frame.setTitle(APP_TITTLE);
    frame.add(root);

    if (!Utilities.isMac()) {
      JMenuBar menuBar = new JMenuBar();

      JMenu fileMenu = new JMenu("File");
      menuBar.add(fileMenu);

      openAction = new JMenuItem("Open");
      saveAction = new JMenuItem("Save");
      runAction = new JMenuItem("Run");

      fileMenu.add(openAction);
      fileMenu.add(openAction);
      fileMenu.add(runAction);

      frame.setJMenuBar(menuBar);
    }

    openAction.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            openEvent();
            network.repaint();
          }
        });

    saveAction.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            saveEvent();
          }
        });

    runAction.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            runSimulation();
          }
        });

    frame.pack();
    frame.setMinimumSize(new Dimension(848, 500));
    frame.setLocationRelativeTo(null);

    clearInterface();

    frame.setVisible(true);

    openINPButton.addActionListener(this);
    runSimulationButton.addActionListener(this);
    logoB.addActionListener(this);
    checkTanks.addActionListener(this);
    checkNodes.addActionListener(this);
    checkPipes.addActionListener(this);
    saveButton.addActionListener(this);
    // runMSXButton.addActionListener(this);
    // saveReport.addActionListener(this);

    frame.addWindowListener(
        new WindowListener() {
          public void windowOpened(WindowEvent e) {}

          public void windowClosing(WindowEvent e) {
            for (Handler handler : log.getHandlers()) {
              handler.flush();
            }
            System.exit(0);
          }

          public void windowClosed(WindowEvent e) {}

          public void windowIconified(WindowEvent e) {}

          public void windowDeiconified(WindowEvent e) {}

          public void windowActivated(WindowEvent e) {}

          public void windowDeactivated(WindowEvent e) {}
        });
  }