[JAVA] Write Processing in IntelliJ IDEA

This is Qiita's first post. If you have any questions, please let me know.

Reasons to write in IntelliJ

The Processing app does not have a code completion function and is very difficult to use as a code editor. Other than that, there is no function like that provided by a normal IDE. With IntelliJ, you can write it as a normal Java file instead of a special file called PDE. In addition, IntelliJ has endless features such as easy project management with VCS (Git, etc.). You can even write in a lambda expression.

There are other famous Java IDEs such as Eclipse, but this time I will use IntelliJ IDEA. (There is also a reason that I like it. It's basically free to use, so please give it a try.)

Method

1. Create a project

Click ** Create New Project **.

The framework selection screen will appear, but do nothing and click ** Next **.

Click ** Next ** without selecting a template.

Decide on a project name and directory. This time it is created as follows. After entering, click ** Finish **.

When you see a screen like this, project creation is complete.

2. Add Processing as a library

Allows you to write Processing by adding Processing as a library. There is also a way to add core.jar, but this time I will use ** Maven **. See below for what is called Maven. I summarized Maven

Click ** File> Project Structure ... **.

Select ** Libraries ** from the menu on the left.

Click ** +> From Maven ... **.

Enter ** org.processing ** to search. Select ** org.processing: core **. Please check here for the latest version. (This time 3.2.3)

If you check ** Download to **, it will be downloaded to any directory and added as a library. Click ** OK **.

If it is displayed like this, it's okay. Click ** OK **.

Make sure it is downloaded to the directory you selected in Download to earlier.

This completes the library addition.

3. Create Java file

To write Processing as a Java file, first create the target Java file.

Right click ** src ** and select ** New> Package **. Enter the Package name to create it.

This time, I created a Package named Qiita.

Then right-click on the Package you just created and select ** New> Java Class **. Enter the Class name and create it.

This time, I created a Class named Main.

Finally, write Processing as a Java file.

4. Write Processing as a Java file

I will write the origin of Processing in the class created earlier. The basic example is shown below.

Main.java


import processing.core.*;

public class Main extends PApplet {

    @Override
    public void settings() {
    }

    @Override
    public void setup() {

    }

    @Override
    public void draw() {

    }

    public static void main(String[] args){
        PApplet.main("Qiita.Main");
    }
}

Basically, it inherits PApplet and starts it with the main method. When executed, the following screen will be displayed.

After that, you can write Processing and Java normally. I think this will further expand the range of expression and development, so please give it a try. Feel free to ask questions or make corrections.

Recommended Posts

Write Processing in IntelliJ IDEA
Java + OpenCV 3.X in IntelliJ IDEA
Optimize Java import declarations in IntelliJ IDEA
IntelliJ IDEA settings
About Stream Debugger in IntelliJ IDEA plugin
Settings to display Japanese Javadoc in IntelliJ IDEA
Use MouseListener in Processing
Failed to launch checking at Kotlin Koans in IntelliJ IDEA
Write flyway callbacks in Java
[IntelliJ IDEA] Perform Unit Test
Hot deploy with IntelliJ IDEA
Measured parallel processing in Java
Write Java8-like code in Java8
Try using IntelliJ IDEA once
Write rich text in Clojure
Mazume judgment processing in fishing
Simultaneous key press in Processing
Try implementing asynchronous processing in Azure
Do HelloWorld in Java / IntelliJ / Gradle
[Rails] How to write in Japanese
Date processing in Java (LocalDate: Initialization)
Write test code in Spring Boot
[React Native] Write Native Module in Swift
Recognize Rails projects with Intellij idea
Implementation of asynchronous processing in Tomcat
Write keys and values in Ruby
Self-pipe technique useful in IO.select processing
Event processing is performed in Spring.
About file copy processing in Java
Order of processing in the program
Setting project environment variables in intelliJ
Develop Processing with IntelliJ + Kotlin + Gradle
Creating a project (and GitHub repository) using Java and Gradle in IntelliJ IDEA
Java --Introduce CheckStyle plugin to IntelliJ IDEA and reflect it in formatter