Introduction to java netbeans

Post on 27-May-2015

865 views 3 download

Tags:

description

Puzzling How to Start with Java Netbeans?? Here is the simple tutorial to get started.

Transcript of Introduction to java netbeans

Introduction to Java Netbeans

Shrey Goswami

What is an IDE? IDE(Integrated Development Environment) is a programming environment integrated into a software application that provides a GUI builder, a text or code editor, a compiler and/or interpreter and a debugger. Visual Studio,Netbeans and DreamWeaver are all examples of IDEs.

What is java?java is a object oriented programming language which enables you to create applications.

Introduction

Install JAVA JDK. Install Netbeans IDE.

Requirements:

Netbeans IDE: layout.

Creating the Netbeans Project in java.

Navigate to File>New Project.

Create New Project

Select java in categories and java Applications

in projects.

Give project name and uncheck create main class and click Finish.

You can finally see Your Project in Projects. In next step, we will create jFrame in it.

Working with jFrame in Netbeans

A jFrame Form acts as a container to place other components like the button,text field and text area etc.

We can create as many forms we want in a Netbeans Project.

jFrame

A jFrame containing jLabel, jTextField and jButton.

To Create a new jFrame click project name in projects and right click>New>jframe Form..

Creating jFrame in Project.

To Create a new jFrame click project name in projects and right click>New>jframe Form.. And then dialog will open where you have to give name and click on Finish.

Now your jFrame is created and now you can add components like Label,Button,TextField etc.

You can see The jFrame is indicated with red indicator in Project Folder as well as in Design view.

Now you can add swing components from Palette by draging on to the design view and arranging according to your idea.

The Palette is indicated with red border.

Now I have added jlabel,jTextField and Button to the jFrame. The jTextField is indicated with Red indicator,jButton with

Blue and jlabel with brown indicator.

As we have now added the components we can edit the variable name,text of the components by just selecting them in the jFrame and right click.

As you can see we can edit the text,change variable name,properties and so on.

Now as a example we can make a application where user will enter the name in jTextField and will get the name back in jLabel after clicking on the jButton.

To achieve it we have already designed the layout but have to add functionality by adding code in the jButton as all the task will be done after clicking the button.

To add Code double click on button and you will be switched automatically to Source Code.

Adding the Following code written in Red Block.

Before you complete, check the component names as it may be different in your and my case.

In My Case: jLabel1,jTextField1. You can change the component name by going to Design and selecting

component then right click and navigate to change variable name. Now its done, and you can run it by holding Shift key and F6 together. Wait and the Application will run like the screenshot below. Just test it by Typing your name and clicking “CLICK ME”. You should get

the text you written in jLabel.

Thats All done from the Introduction. In Next Slide you will learn about different Components of Java like jLabel,jTextField etc that we used in this example.

THANK YOU