Introduction to java netbeans

21
Introduction to Java Netbeans Shrey Goswami

description

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

Transcript of Introduction to java netbeans

Page 1: Introduction to java netbeans

Introduction to Java Netbeans

Shrey Goswami

Page 2: Introduction to java netbeans

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

Page 3: Introduction to java netbeans

Install JAVA JDK. Install Netbeans IDE.

Requirements:

Page 4: Introduction to java netbeans

Netbeans IDE: layout.

Page 5: Introduction to java netbeans

Creating the Netbeans Project in java.

Page 6: Introduction to java netbeans

Navigate to File>New Project.

Create New Project

Page 7: Introduction to java netbeans

Select java in categories and java Applications

in projects.

Page 8: Introduction to java netbeans

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

Page 9: Introduction to java netbeans

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

Page 10: Introduction to java netbeans

Working with jFrame in Netbeans

Page 11: Introduction to java 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.

Page 12: Introduction to java netbeans

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

Creating jFrame in Project.

Page 13: Introduction to java netbeans

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.

Page 14: Introduction to java netbeans

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.

Page 15: Introduction to java netbeans

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.

Page 16: Introduction to java netbeans

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.

Page 17: Introduction to java netbeans

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.

Page 18: Introduction to java netbeans

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.

Page 19: Introduction to java netbeans

Adding the Following code written in Red Block.

Page 20: Introduction to java netbeans

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.

Page 21: Introduction to java netbeans

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