Wednesday, February 27, 2008

JAVA BASIC GUI


THE GUI DESIGN

/*This program gives basic GUI design.*/

//some import statment for GUI & Handling event

import javax.swing.*;
import java.awt.event.*;

public class gui extends JFrame implements ActionListener
{

JLabel msg;

JLabel no;
JTextField text;
JTextArea ta;
JButton b;

public gui(String title)
{

super(title);

msg = new JLabel("");
no = new JLabel("Enter NO: ");
text = new JTextField("",10);
ta = new JTextArea(2,30);
b=new JButton("SUBMIT");

setLayout(new FlowLayout());

add(no);
add(text);
add(msg);
add(ta);
add(b);

b.addActionListener(this);

}

public void actionPerformed(ActionEvent e)
{

//write code for after pressing Button

}
public static void main(String[] args)
{

JFrame a=new gui("gui");
a.setSize(350,300);
a.setVisible(true);

}

}



1 comment:

Anonymous said...

Can u give me the code for sql data connection. please

Sign by Rohit Lagu - SUPPORTED BY WE AND COMPUTER