Tuesday 20 September 2011

Interface using GUI Component in java for Database application


import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Student{
Frame f=new Frame("student");
Panel p;
JLabel l,l1,l2,l3;
JTextField t,t1,t2,t3;
JButton b,b1,b2,b3,b4;//insert,update,record,find,delete
public Student(){

f.setLayout(null);

l=new JLabel("Roll No.");

l.setLayout(null);

l1=new JLabel("Student Name");
l1.setLayout(null);
l2=new JLabel("Address");
l2.setLayout(null);
l3=new JLabel("Course");
l3.setLayout(null);
l.setLocation(60,50);
l.setSize(60,20);
t=new JTextField();
t.setLocation(120,50);
t.setSize(100,20);
l1.setLocation(270,50);
l1.setSize(80,20);
t1=new JTextField();
t1.setLocation(380,50);
t1.setSize(100,20);


l2.setLocation(60,90);
l2.setSize(60,20);
t2=new JTextField();
t2.setLocation(120,90);
t2.setSize(100,20);



l3.setLocation(270,90);
l3.setSize(80,20);
t3=new JTextField();
t3.setLocation(380,90);
t3.setSize(100,20);


p=new Panel();
p.setLayout(null);
p.setLocation(0,170);
p.setSize(1024,70);
p.setBackground(Color.gray);



b=new JButton("add");
b.setLayout(null);
b.setLocation(50,10);
b.setSize(70,30);
b.setForeground(Color.blue);



b1=new JButton("update");
b1.setLayout(null);
b1.setLocation(130,10);
b1.setSize(90,30);
b1.setForeground(Color.blue);




b2=new JButton("search");
b2.setLayout(null);
b2.setLocation(230,10);
b2.setSize(100,30);
b2.setForeground(Color.blue);




b3=new JButton("delete");
b3.setLayout(null);
b3.setLocation(340,10);
b3.setSize(100,30);
b3.setForeground(Color.blue);


p.add(b);
p.add(b1);

p.add(b2);

p.add(b3);
f.add(l);
f.add(t);

f.add(l1);
f.add(t1);


f.add(l2);
f.add(t2);

f.add(l3);
f.add(t3);
f.add(p);





f.setSize(800,800);
f.setVisible(true);


}//end of constructor

public static void main(String m[]){
new Student();

}//end of main
}//end of class

No comments:

Post a Comment