Thursday, May 01, 2008

NetBeans - The easy java ide

Java is the cross-platform object oriented language for making dynamic desktop
and web applications. I used to code in java with notepad, until I found an ide
which could help me save my time!

The Ide is NetBeans and it helps you a lot by giving you visual editing environment.

Here is a short tutorial on how to design a small java application using net beans.

You can follow the steps to have a perfect project.

You can download net beans from the netbeans website

1.) Open the netbeans ide, and you will see a screen like that in the below figure


2.) Go to File > New Project, in the General category choose Java Aplication
and click next.



3.) Enter your project name, location and folder. Check the set main project
and create main class check boxes.


4.) From the Project toolbar select your project and right click > new > JFrame Form.
A window will open and you have to enter your class name. Then you will see
a visual editing component on your screen. This will help you layout your application.

5.)Using the palette toolbar to your right, double click on the JButton control and
click it on the design area on the center. Now, Double click JLabel and do the same.
Place it right under the button.



6.) You can use the properties box to change the properties of your controls.
Change the label of you button and the remove the text of the label.

7.) Select the button and Right click > events > actionperformed.
A code window will appear and you will see a section with code:

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}


8.) Replace the // TODO add your handling code here: with the following code:

jLabel1.setText("Thank you for clicking me!");


The program is ready and set to go for compiling and running.

Here is how to run it:

1.) Goto Build > Build Main Project. The result will be given in the build box at the bottom.

2.) Goto Run > Run File > JFrame.java

you will see your finished application!

No comments:

Photos         Videos         Travelogues         Reviews