View Student Details
View Student Details
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import java.sql.*;
public class ViewStudentDetails extends JFrame
{
String x[]={"Name","Username","Email","Father
Name","Phone","section","class","Gender","Blood Group","DOB","Roll_no"};
String y[][]=new String[20][13];
int i=0,j=0;
JTable t;
Font f;
ViewStudentDetails()
{super("Teacher Information");
setSize(1500,400);
setLocation(1, 1);
f=new Font("Arial",Font.BOLD,15);
try
{ ConnectionClass obj=new ConnectionClass();
String q="Select*from student";
ResultSet rest =obj.stm.executeQuery(q);
while (rest.next())
{ y[i][j++]=rest.getString("name");
y[i][j++]=rest.getString("username");
y[i][j++]=rest.getString("email");
y[i][j++]=rest.getString("father_name");
y[i][j++]=rest.getString("phone");
y[i][j++]=rest.getString("section");
y[i][j++]=rest.getString("class");
y[i][j++]=rest.getString("gender");
y[i][j++]=rest.getString("blood");
y[i][j++]=rest.getString("dob");
y[i][j++]=rest.getString("roll_no");
i++;
j=0;}
t=new JTable(y,x);
t.setFont(f);
t.setForeground(Color.BLACK);
t.setBackground(Color.WHITE);
JScrollPane sp=new JScrollPane(t);
add(sp);
} catch (Exception ex)
{ ex.printStackTrace();} }
public static void main(String[] args)
{ new ViewStudentDetails().setVisible(true); }}