Home arrow Java arrow Page 4 - Developing Java Applications using NetBeans

Developing Java Applications using NetBeans

This article introduces you to all of the Java productive tools available in the market. It also explains how to develop simple Java applications using NetBeans IDE.

Author Info:
By: Jagadish Chaterjee
Rating: 4 stars4 stars4 stars4 stars4 stars / 28
May 03, 2006
  1. · Developing Java Applications using NetBeans
  2. · Which tool for what?
  3. · Creating a console application using NetBeans IDE
  4. · Creating a desktop application using NetBeans IDE

print this article

Developing Java Applications using NetBeans - Creating a desktop application using NetBeans IDE
(Page 4 of 4 )

Once you install NetBeans IDE 4.1, you should be able to see "NetBeans 4.1" in your programs list.  Try opening your tool by going to start -> programs -> Net Beans 4.1 -> NetBeans IDE.

Let us create a simple console application using the same IDE.  With the NetBeans IDE open, go through the following steps:

  • Go to File -> New project (or you can directly press the "New Project" button) as highlighted in the following figure.

  • You will be presented with a "New Project" window.  Select "General" in the "categories" and "Java Application" in the "Projects" (as shown in the figure below).

  • After selecting accordingly click "next."  You will be presented with the "New Java Application" window.
  • Give the "Project Name" as "HelloWorld," provide your own location, and switch off the "Create Main Class" check box.  Your window must look something like the one below.

  • Once it looks like the above, click on "Finish."  At this moment, you will not see any code (like you did in the previous section). 
  • Go to the "Projects" window, open up "DesktopHelloWorld," right click on "Source Packages," go to new -> JFrame Form  as shown below.

  • In the "New JFrame" window, provide the class name "SampleJFrame" and provide package name "SamplePack." Finally click finish.
  • Now you will be able to see the "form design" mode (which is very similar to VB6 or VB.NET).  For this demonstration, you simply right click on the form (in design mode), and go to Set Layout -> Null Layout.
  • From the "Pallete" window, click on "JButton" and click on "form design." It will be automatically added to the form.  Make sure that the dragging and dropping of controls is not permitted yet.  You can observe that the "Pallete" window is very similar to the "ToolBox" in VB6.
  • You can drag and resize the button according to your wishes.  Try playing with all of its properties.  If you don't see a properties window, right-click on the button and go for "properties."  It is very similar to the properties window that you see in VB6.
  • Provide "Show" as a value for the "text" property for the button.  You can even rename the button by directly right clicking and selecting rename from the "inspector" window (as shown below).

  • Similarly add a "JLabel," set its "text" to empty and rename it "lblMsg."
  • Next, double click on the button (which opens the code window) and modify your code as follows:

public class SampleJFrame extends javax.swing.JFrame {   

    public SampleJFrame() {
    private void jButton1ActionPerformed
(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
        this.lblMsg.setText("Hello World!");

  • Hit F5 to execute your project (along with debugging). It will present you with the following figure.

  • Just hit "Ok" and get going on.
  • You must see the output as in the figure below.

  • Once you hit "Show," you must see the figure below.

Keep watching for articles about the "NetBeans IDE" on this website.  I am introducing more and more topics that cover working with "NetBeans IDE" together with Java development.

Any comments, suggestions, feedback, bugs, errors, enhancements are highly appreciated at jag_chat@yahoo.com

DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

blog comments powered by Disqus

- Java Too Insecure, Says Microsoft Researcher
- Google Beats Oracle in Java Ruling
- Deploying Multiple Java Applets as One
- Deploying Java Applets
- Understanding Deployment Frameworks
- Database Programming in Java Using JDBC
- Extension Interfaces and SAX
- Entities, Handlers and SAX
- Advanced SAX
- Conversions and Java Print Streams
- Formatters and Java Print Streams
- Java Print Streams
- Wildcards, Arrays, and Generics in Java
- Wildcards and Generic Methods in Java
- Finishing the Project: Java Web Development ...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials