Simple Java Desktop Application in Netbeans-8.XX

This tutorial will show how to create a Java Desktop Application (Graphical User Interface -GUI), using Netbeans-8.x.
Content:
1. Create New Project
2. Add an Application Sample Form
3. Run Project
Pre-requirement: NetBeans 8.x Installed your Computer.
1. Create New Project:
Open your Netbeans-IDE. You should see something like this when start the IDE.



Now click ()or Select "New Project" from the file menu.

Select "Java" in the Categories menu, and "Java Application", then click next.


This windows is an important windows for your project. Flowing settings fill-up on this windows: 


1. Project Name: ………………….. (Your project name)
2. Project Location: …………………. (Where you create project. Just Browse this path)
3. Create Main Class: …………….. (Here is fill-up your main package and main class)
After fill-up settings click on Finish button.

Wait for a few time, show this windows.



2. Add an Application Sample Form:




Right click in a java package and select “New”, then “Other” at the bottom of the menu.



Select “Swing GUI Forms” and “Application Sample Form” ", then click next.



Put the class name as …… (HomeWindow) and Package as ………. (sample.desktop.project.form). Click Finish.
Netbeans has done all the work, show this windows.



You can view the GUI by clicking the Preview Design icon ().



3. Run Project:
Click on () or Right Click on your project and select Run


If you run this project, but not show HomeWindows.
So you open your main class and add this code in main function :





HomeWindow mainWin = new HomeWindow();mainWin.setLocationRelativeTo(null);mainWin.setVisible(true);

Your main class as SampleDesktopProject_01.java:
package sample.desktop.project; import sample.desktop.project.form.HomeWindow; public class SampleDesktopProject_01 { public static void main(String[] args) { HomeWindow mainWin = new HomeWindow(); mainWin.setLocationRelativeTo(null); mainWin.setVisible(true); } }
Now run your project.



Share on Google Plus

About Samsul Hoque

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment