Tuesday, January 15, 2008

Java Swing Example

A part of Sun Microsystems Java Foundation classes (JFC) is a widget toolkit for providing a graphical user interface. It consists of many tools including boxes, combo box, list box, buttons, dialog boxes, tables etc.

It is very interesting part of Java programming. It is the favorite topic of all the java programmers. We can customize the components and use it according to our requirements. Lets start with first program :

This program explain you how to create text area using Java swing. Here we are using javax.swing package to create GUI component. The text area will be created on panel in the frame :

import javax.swing.*;
public class TextAreaCode {
public static void main(String[] args){
JFrame frame= new JFrame("TextArea-Frame Program");
JPanel panel=new JPanel();
JTextArea jt= new JTextArea("TextArea Example",4,20);

Click Here for More example on Java Swing