Tuesday, November 30, 2010

Java swing event handling example programs for beginners

Java uses delegation event model approach to handle events.

What is delegation event model?
Concept is quite simple:a source generate an event and sends it to one or ore listeners.In this scheme, the listener waits until it receive an event. Once an event is received, the listener process the event and and then returns.

Here are short definitions of event, source, listeners.

Event :
An event is an object that describes a state change in a source. It can be generated as a consequence of a person interacting with the elements in a graphical user interface.

Monday, November 22, 2010

How to create a menu bar and add a menu separator in java swing with eclipse

As we know java swing provides more liveliness to a web page, we can create menu bar using simple steps in java swing, which helps user to do his/her operations quickly.With out menu the task will be more tedious and very complex, so every one needs to menu bar  in web page. Now lets start with a simple swing program, as by program you can get it more quickly and easily.
To start a Java  program in Eclipse see here

//Java swing menu bar program starts

Java swing tutorial

In short swing is a widget toolkit for Java. It is part of Sun Microsystems' Java Foundation Classes (JFC) -- an API for providing a graphical user.

Multithreading in java examples

Multithreading computers have hardware support to efficiently execute multiple threads. These are distinguished from multiprocessing systems.


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 :