This is Qiita's first post. If you have any questions, please let me know.
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.)
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.
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.
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.
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