Sunday, November 21, 2010

java Applet example tutorial for beginners

Applet is a Java application; an application program that uses the client's web browser to provide a user interface.

Packages in java

Packages in java  is a mechanism for organizing Java classes into namespaces similar to the modules of Modula

Thursday, November 18, 2010

How to create a swing applet and application in eclipse

What are applets in java?
Applets are not  stand-alone programs.They run within either a web browser or applet viewer. Applet is included in html page using <applet>. See a applet example here.

What is swing in java?
 swing can be used as stand-alone and also as a applet.
Lets start a swing applet.Before that just have a look at simple swing stand-alone program.
Now start Eclipse IDE. See here how to start an eclipse 
A swing applet program
/*

Monday, November 15, 2010

Java swing tutorial examples for beginners with eclipse

About Java swing
 
Java introduced swing concept to give a response to deficiency present in java awt. The AWT defines the basic set of controls, windows, and dialog boxes that support usable, but limited graphical interface.

As AWT uses native resources they are called as heavy weight components, and swing are light weight components. Presently most of programmers prefer swing to awt.

This doesn`t mean that AWT are replaced by swing.To become a swing programmer you have to learn AWT has many of awt components are used in swings.

In this tutorial you will learn both awt and swing simultaneously.
Now, lets start with basic one. How to write a swing?

Thursday, November 11, 2010

How to open notepad using java program

It is very simple to open a note pad using your java program..

And this is achieved by a class named ProcessBuilder ,
All processes are represented Process class and ProcessBuilder offers more control more over the processes.

ProcessBuilder defines three constructors.

ProcessBuilder(List<String> args)

ProcessBuilder(String.....arg)

Saturday, November 6, 2010

How to compile java program in Eclipse IDE

We all know Eclipse is an IDE (integrated development environment) for Java.We have many IDE but I prefer Eclipse.

Start with First Download Eclipse  and J2SE (JDK kit).(Download ECLIPSE) and (Download Java).

You will get Eclipse in Winrar file extract it.And then double click on eclipse.exe icon to start.

How to start a java program?
After installing Eclipse,a window will open.
Go to File--->New-->(Click)Java project.

Wednesday, November 3, 2010

How to set thread priority in java - tutorial with examples

As an application program may have many Threads ,to run all threads at a time,Thread scheduler is run.Though in theory,higher priority threads get more CPU time than lower priority threads,but in practice CPU time may vary from one operating system to other,on how OS is implementing multitask.

   As a Java programmer you need to be very careful while handling threads,as java is designed to work on different environments of OS,programmer  should be see that all threads will get a chance to run.
This can be achieved by handling threads using Thread priorities...
setting priority :