Java: Create a Basic Application

If you don’t know how to make a new project, I refer you to my old blog on it.

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.

frame.setSize(500, 300);

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.

Other Tutorial for your Level:
Java: How To Create an Organize New Project
Java: How to Create Button


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s