Esempio n. 1
0
  /** @param args the command line arguments */
  public static void main(String args[]) {
    m_inst = SingleAppInstance.getInstance();
    /*
     * if you wish to execute more than one applications at a single time,
     * from within the same folder use the method below instead, in order
     * to specify the unique filename to create and lock.
     *
     * m_inst = SingleAppInstance.getInstance(
     *              JTester.class.getSimpleName() + ".run" );
     */

    /*
     * if you wish to be notified via stderr instead a popup window, use
     * the method below. Execute now 2 times the 'test.bat' and see what
     * happens!
     *
     * m_inst.setReportPopup( false );
     */

    // notify SingleAppInstance that our application started...
    m_inst.onInit();

    java.awt.EventQueue.invokeLater(
        new Runnable() {
          public void run() {
            new JTester().setVisible(true);
          }
        });
  }
Esempio n. 2
0
  private void normal_exit() {
    // at the end make sure we notify SingleAppInstance
    // that our application finished...
    m_inst.onExit();

    long nanos = m_timerNanos.elapsedNanos();
    double millis2 = m_timerNanos.elapsedMillis();
    double secs2 = m_timerNanos.elapsedSeconds();
    long millis = m_timerMillis.elapsedMillis();
    double secs = m_timerMillis.elapsedSeconds();
    System.out.println(
        "user time: "
            + nanos
            + " nanoseconds, "
            + millis2
            + " milliseconds, "
            + secs2
            + " seconds.");
    System.out.println("user time: " + millis + " milliseconds, " + secs + " seconds.");

    System.exit(0);
  }