Rechercher

Java: Create a Basic Application

First of all, let’s make our first class, I will name it “Main” because it’s our main class and place it on our main Package too. Check the “public static void main(String[] args)” checkbox. That will create the “main” method where we will put the main code.

Now let’s make the brainstorm of what we are planning to do. I want to make a window where we will click on different button to change the text of a label. I’m suggesting a nice online application to make brain mappings and it’s MindMup 2. This app is useful to have a good structure when you’re developing big or small application.

Now let’s start creating our application. Use your class “Main” and write in the “main” method:

JFrame frame = new JFrame();

That mean that you create your first window. Let’s add attribute to the frame.

If you create a frame but you forget to set your frame visible, your window will all simply never show up. Your frame is now ready, try to click on the “Run” button (the green button) to see your application. This will help you to continue in the futur tutorial.