This post explain about Java Swing Application Design in NetBeans IDE. When you want to create an application in java with fast and easy way, you can use NetBeans IDE. where you can easily drag drop controls (Applets) into your application. In this article SKOTechLearn will describe the way to Create Swing GUI Project in Java with jframe Design in java netbeans.
What is Swing GUI Project in JAVA Netbeans?
Java Swing is base on Graphical User Interface (GUI) toolkit includes Javax.swing base Palette containg components for creating java application.You can use this palette’s components like jLabel, jButton, jComboBox, etc in jFrame class inside package.
How to Open jFrame from Another jFrame with Button's Click in Java Swing?
How to Create New Project in NetBeans:
First of all when you open Netbeans, you find that start windows has been opened.
➤ Just find the “File” menu and select and press “New Project…” or directly press on this icon button from toolbox as we mention following.
➤ Just find the “File” menu and select and press “New Project…” or directly press on this icon button from toolbox as we mention following.
Create New Project Process |
You can see that we point out steps in numbers on above image.
➤ Now as well as you press on “New Project” button or option, it will show screen of “New Project”.
➤ Just select “Java” and then select “Java Application”
➤ After that press “Next” button.
Messages Style in Java Using jOptionPane.
➤ Now as well as you press on “New Project” button or option, it will show screen of “New Project”.
➤ Just select “Java” and then select “Java Application”
➤ After that press “Next” button.
Messages Style in Java Using jOptionPane.
Java Project Name and Path Settings in NetBeans:
Name_and_Location_Setting |
Now next screen will appear for 'Name and Location' setting.
➤ You have to type desire project Name in "Project Name:" box.
➤ Browse location where you want to save it through "Browse.." Button or input desire path on "Project Location:" box.
➤ If you want to create your default class as Main class then leave it as well just as mention in figure in point no. 3. Or unmarked on check box and leave it blank for further defining class.
➤ You have to type desire project Name in "Project Name:" box.
➤ Browse location where you want to save it through "Browse.." Button or input desire path on "Project Location:" box.
➤ If you want to create your default class as Main class then leave it as well just as mention in figure in point no. 3. Or unmarked on check box and leave it blank for further defining class.
➤ Then press “Finish” button. Now it has been ready for programming.
But when you click on default class, it will not show any “Design” view option. You have to Add jFrame Form or jPanel Form from IDE.
Default Java Class without Design View |
Radio Button (option button) in Java Swing with Use and Different Style and Look
Add New jFrame in NetBeans:
If you want to create Swing jFrame:➤ Just right click on your “Packages” like “javaapplication1”.
➤ From Right click’s drop down menu list, select “New…” option.
➤ When you focus on it, it will again show you sub menu list, just find “jFrame Form…” and select it.
➤ This process will display you a “New jFrame Form” screen.
Just follow the image mention steps:
Add New jFrame Form Class for Design |
➤ After that just input new 'Class Name' or you can leave as default class name.
➤ Then press “Finish” button.
Now your new GUI base jFrame Class will add to your application package. And it will appear in NetBeans with “Design” view mode.
Tips of Designing jList and Steps to Showing Data in jList
Design Form with Java Swing Controls:
Now, you are ready to prepare application with GUI mode.➤ Normally you can drag and drop controls or swing controls from 'Palette' window in the right side of NetBeans IDE screen.
For example we drag jLabel and jButton for testing purpose and will write some code inside jButton's “ActionPerformed” event.
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { jLabel1.setText("You Clicked on Button"); }
➤ You can easily switch from “Source” Screen to “Design” Screen by click on it. For more understanding purpose, check out the following image.
jFrame with Design View and Swing Controls Example |
Now, this is the simple and easy way which SKOTechLearn describe how to Create Swing GUI Project in Java NetBeans and Design jFrame in java NetBeans.
Learn, How To Connect SQL Server Database in Netbeans?
Learn, How To Connect SQL Server Database in Netbeans?
0 comments: