How can use this java file inside processing sketch

how can i call the startup() function from processing sketch ?

/*

  • LiveRecognitionApp.java
    */

package liverecognition;

import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;
import java.awt.event.*;

/**

  • The main class of the application.
    */
    public class LiveRecognitionApp extends SingleFrameApplication {

    private LiveRecognitionView liveRecognitionViewFrame;

    /**

    • At startup create and show the main frame of the application.
      */
      @Override protected void startup() {
      liveRecognitionViewFrame = new LiveRecognitionView(this);
      show(liveRecognitionViewFrame);
      }

    /**

    • This method is to initialize the specified window by injecting resources.
    • Windows shown in our application come fully initialized from the GUI
    • builder, so this additional configuration is not needed.
      */
      @Override protected void configureWindow(java.awt.Window root) {
      root.addWindowListener(new WindowAdapter() {
      @Override
      public void windowClosing(WindowEvent e) {
      liveRecognitionViewFrame.drawingTimer.stop();
      try{
      Thread.sleep(40);
      }
      catch (java.lang.InterruptedException exception){
      }
      liveRecognitionViewFrame.saveTracker();
      liveRecognitionViewFrame.closeCamera();
      }
      });
      }

    /**

    • A convenient static getter for the application instance.
    • @return the instance of LiveRecognitionApp
      */
      public static LiveRecognitionApp getApplication() {
      return Application.getInstance(LiveRecognitionApp.class);
      }

    /**

    • Main method launching the application.
      */
      public static void main(String[] args) {
      launch(LiveRecognitionApp.class, args);
      }
      }

Hi Basher,
I would use the </> button to format your code correctly on the forum. That way, we can see what is actually commented out and such.

  • Trilobyte

What does this class do? If this is generating some gui interface, then I am not sure if you can use it in Processing sketch. Processing has a PApplet instance that is managing the window and drawing resources for you. Not sure how easy is to hook an object of your class to the Processing engine. You will need to dig under the hood aka. check the source code available in github. However, doing this just breaks the basic goal of a Processing app which is to keep your apps simple as the PApplet is doing all the heavy lifting for you.

Kf