FEEDBACK SYSTEM USING SWINGS:
````````````````````````````````````````````````````````
admin.java:
~~~~~~~~~
import java.awt.*;
import java.sql.*;
import javax.swing.*;
import java.awt.event.*;
public class admin extends Frame implements
ActionListener,WindowListener
{
private static final
long serialVersionUID = 1L;
TextField un=new
TextField();
TextField pw=new
TextField();
Label un1=new
Label("User Name");
Label pw1=new
Label("Password");
Button li=new
Button("Login");
Button cl=new
Button("Cancel");
public admin()
{
JLabel header=new
JLabel("ADMIN LOGIN");
header.setFont(new
Font("Times New Roman", Font.BOLD,20));
un1.setFont(new
Font("Times New Roman", Font.BOLD,15));
pw1.setFont(new
Font("Times New Roman", Font.BOLD,15));
li.setFont(new
Font("Times New Roman", Font.BOLD,15));
cl.setFont(new
Font("Times New Roman", Font.BOLD,15));
li.setForeground(Color.blue);
cl.setForeground(Color.blue);
li.setBackground(Color.white);
cl.setBackground(Color.white);
setLayout(null);
addWindowListener(this);
header.setBounds(80,50,1000,30);
un1.setBounds(50,80,100,30);
un.setBounds(150,80,100,30);
pw1.setBounds(50,110,100,30);
pw.setBounds(150,110,100,30);
li.setBounds(50,140,100,30);
cl.setBounds(150,140,100,30);
pw.setEchoChar('@');
add(header);
add(un1);add(un);
add(pw1);add(pw);
add(li);add(cl);
li.addActionListener(this);
cl.addActionListener(this);
}
public void
windowOpened(WindowEvent ae)
{
System.out.println("open");
}
public void
windowClosed(WindowEvent ae)
{
System.out.println("closed");
}
public void
windowClosing(WindowEvent ae)
{
System.exit(0);
}
public void
windowIconified(WindowEvent ae)
{
System.out.println("iconified");
}
public void
windowDeiconified(WindowEvent ae)
{
System.out.println("deiconified");
}
public void
windowActivated(WindowEvent ae)
{
System.out.println("activated");
}
public void
windowDeactivated(WindowEvent ae)
{
System.out.println("deactivated");
}
public void
actionPerformed(ActionEvent ae)
{
if(ae.getSource()==li)
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:JEEVAN");
//PreparedStatement
st3=con.prepareStatement("drop table admin");
//if(st3.execute())
//{
// JOptionPane.showMessageDialog(this,"Table
deleted !!!");
//}
//PreparedStatement
st1=con.prepareStatement("create table admin(uname varchar(20),pswd
varchar(20),phoneno varchar(15))");
//if(st1.execute())
//{
// JOptionPane.showMessageDialog(this,"Table
created !!!");
//}
//PreparedStatement
st2=con.prepareStatement("insert into admin values(?,?,?)");
//String
ab="Jayanth";
//String
bc="jayanth";
//String
cd="9611146004";
//st2.setString(1,ab);
//st2.setString(2,bc);
//st2.setString(3,cd);
//if(st2.execute())
//{
// JOptionPane.showMessageDialog(this,"Inserted
!!!");
//}
PreparedStatement
st=con.prepareStatement("select * from admin where uname=? and
pswd=?");
String
a=un.getText();
String
b=pw.getText();
st.setString(1,a);
st.setString(2,b);
ResultSet
rs=st.executeQuery();
if(rs.next())
{
setVisible(false);
JOptionPane.showMessageDialog(this,"Login
Successful !!! Extracting feedbacks......");
feedbackread fb=new
feedbackread();
fb.setVisible(true);
fb.setBackground(Color.white);
fb.setTitle("Feedback
form");
fb.setSize(280,300);
}
else
{
JOptionPane.showMessageDialog(this,"Incorrect
login or password","Error",JOptionPane.ERROR_MESSAGE);
}
}
catch(Exception e)
{
System.out.println("Error
in "+e.getMessage());
JOptionPane.showMessageDialog(this,"Error
in "+e.getMessage());
}
}
else
if(ae.getSource()==cl)
{
setVisible(false);
JOptionPane.showMessageDialog(this,"Cancelled
!!!");
}
}
public static void
main(String h[])
{
admin page=new
admin();
page.setBackground(Color.white);
page.setTitle("Admin
Login");
page.setVisible(true);
page.setSize(300,200);
}
}
feedback.java:
~~~~~~~~~~~~
import java.awt.*;
import java.sql.*;
import javax.swing.*;
import java.awt.event.*;
public class feedback extends Frame implements
ActionListener,WindowListener
{
private static final
long serialVersionUID = 1L;
TextField un=new
TextField();
Label un1=new
Label("Feedback");
Label jl;
Button li=new
Button("Feedback");
Button cl=new
Button("Cancel");
feedback(String a)
{
jl=new Label(a);
un1.setFont(new
Font("Times New Roman", Font.BOLD,15));
li.setFont(new
Font("Times New Roman", Font.BOLD,15));
cl.setFont(new
Font("Times New Roman", Font.BOLD,15));
li.setForeground(Color.blue);
cl.setForeground(Color.blue);
li.setBackground(Color.white);
cl.setBackground(Color.white);
setLayout(null);
addWindowListener(this);
un1.setBounds(50,80,100,30);
un.setBounds(50,110,200,130);
li.setBounds(50,240,100,30);
cl.setBounds(150,240,100,30);
add(un1);add(jl);add(un);
add(li);add(cl);
li.addActionListener(this);
cl.addActionListener(this);
}
public void
windowOpened(WindowEvent ae)
{
System.out.println("open");
}
public void
windowClosed(WindowEvent ae)
{
System.out.println("closed");
}
public void
windowClosing(WindowEvent ae)
{
System.exit(0);
}
public void
windowIconified(WindowEvent ae)
{
System.out.println("iconified");
}
public void
windowDeiconified(WindowEvent ae)
{
System.out.println("deiconified");
}
public void
windowActivated(WindowEvent ae)
{
System.out.println("activated");
}
public void
windowDeactivated(WindowEvent ae)
{
System.out.println("deactivated");
}
public void
actionPerformed(ActionEvent ae)
{
if(ae.getSource()==li)
{
String
a=jl.getText();
String
b=un.getText();
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:JEEVAN");
/*PreparedStatement
st1=con.prepareStatement("delete feedback where uname=?");
st1.setString(1,"Jayanth");
if(st1.execute())
{
JOptionPane.showMessageDialog(this,"deleted
!!!");
}*/
PreparedStatement
st=con.prepareStatement("insert into feedback values(?,?)");
b=un.getText();
st.setString(1,a);
st.setString(2,b);
st.execute();
//if(st.execute())
{
setVisible(false);
JOptionPane.showMessageDialog(this,"Feedback
submitted sucessfully");
}
}
catch(Exception e)
{
System.out.println("Error
in "+e.getMessage());
JOptionPane.showMessageDialog(this,"Error
in "+e.getMessage());
}
}
else
if(ae.getSource()==cl)
{
setVisible(false);
JOptionPane.showMessageDialog(this,"Feedback
Cancelled !!!");
}
}
public static void
main(String h[])
{
login page=new
login();
page.setBackground(Color.white);
page.setTitle("Login");
page.setVisible(true);
page.setSize(300,200);
}
}
feedbackread.java:
`````````````````````````
import java.awt.*;
import java.sql.*;
import javax.swing.*;
import java.awt.event.*;
public class feedbackread extends Frame implements
ActionListener,WindowListener
{
private static final
long serialVersionUID = 1L;
//Panel un=new
Panel();
Button li=new
Button("Refresh");
public feedbackread()
{
///JLabel header=new
JLabel("Feedbacks");
//header.setFont(new
Font("Times New Roman", Font.BOLD,20));
li.setFont(new
Font("Times New Roman", Font.BOLD,15));
li.setForeground(Color.blue);
li.setBackground(Color.white);
setLayout(null);
addWindowListener(this);
//header.setBounds(80,50,1000,30);
//un.setBounds(10,80,500,200);
li.setBounds(50,100,10,30);
//add(header);
setLayout(new
FlowLayout());
add(li);
li.addActionListener(this);
setSize(120,76);
}
public
feedbackread(String a)
{
//JLabel header=new
JLabel("Feedbacks");
//header.setFont(new
Font("Times New Roman", Font.BOLD,20));
li.setFont(new
Font("Times New Roman", Font.BOLD,15));
li.setForeground(Color.blue);
li.setBackground(Color.white);
setLayout(null);
addWindowListener(this);
//header.setBounds(80,50,1000,30);
//un.setBounds(10,80,500,200);
//li.setBounds(50,10,10,30);
//add(header);
setLayout(new
GridLayout());
add(li);
li.addActionListener(this);
}
public void
windowOpened(WindowEvent ae)
{
System.out.println("open");
}
public void
windowClosed(WindowEvent ae)
{
System.out.println("closed");
}
public void
windowClosing(WindowEvent ae)
{
System.exit(0);
}
public void
windowIconified(WindowEvent ae)
{
System.out.println("iconified");
}
public void
windowDeiconified(WindowEvent ae)
{
System.out.println("deiconified");
}
public void
windowActivated(WindowEvent ae)
{
System.out.println("activated");
}
public void
windowDeactivated(WindowEvent ae)
{
setVisible(false);
}
public void
actionPerformed(ActionEvent ae)
{
if(ae.getSource()==li)
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:JEEVAN");
/*PreparedStatement
st1=con.prepareStatement("create table feedback(uname varchar(20),message
varchar(1000))");
if(st1.execute())
{
JOptionPane.showMessageDialog(this,"Table
created !!!");
}*/
PreparedStatement
st=con.prepareStatement("select * from feedback");
ResultSet
rs=st.executeQuery();
if(rs.next())
{
while(rs.next())
{
String
b="a";
feedbackread page=new
feedbackread(b);
page.setBackground(Color.white);
page.setTitle("Feedbacks");
page.setVisible(true);
page.setSize(20,20);
page.setLayout(new
GridLayout(0,2));
page.setBounds(10,10,1200,768);
JLabel jl2=new
JLabel(rs.getString(1));
JLabel jl3=new
JLabel(rs.getString(2));
page.add(jl2);page.add(jl3);
setVisible(false);
//page.add(li);
}
}
else
{
JOptionPane.showMessageDialog(this,"Incorrect
login or password","Error",JOptionPane.ERROR_MESSAGE);
}
}
catch(Exception e)
{
System.out.println("Error
in "+e.getMessage());
JOptionPane.showMessageDialog(this,"Error
in "+e.getMessage());
}
}
}
public static void
main(String h[])
{
feedbackread page=new
feedbackread();
page.setBackground(Color.white);
page.setTitle("Feedbacks");
page.setVisible(false);
page.setSize(300,200);
page.setLayout(new
GridLayout(0,1));
// page.setBounds(10,10,300,76);
}
}
login.java:
````````````
import java.awt.*;
import java.sql.*;
import javax.swing.*;
import java.awt.event.*;
public class feedbackread extends Frame implements
ActionListener,WindowListener
{
private static final
long serialVersionUID = 1L;
//Panel un=new
Panel();
Button li=new
Button("Refresh");
public feedbackread()
{
///JLabel header=new
JLabel("Feedbacks");
//header.setFont(new
Font("Times New Roman", Font.BOLD,20));
li.setFont(new
Font("Times New Roman", Font.BOLD,15));
li.setForeground(Color.blue);
li.setBackground(Color.white);
setLayout(null);
addWindowListener(this);
//header.setBounds(80,50,1000,30);
//un.setBounds(10,80,500,200);
li.setBounds(50,100,10,30);
//add(header);
setLayout(new
FlowLayout());
add(li);
li.addActionListener(this);
setSize(120,76);
}
public
feedbackread(String a)
{
//JLabel header=new
JLabel("Feedbacks");
//header.setFont(new
Font("Times New Roman", Font.BOLD,20));
li.setFont(new
Font("Times New Roman", Font.BOLD,15));
li.setForeground(Color.blue);
li.setBackground(Color.white);
setLayout(null);
addWindowListener(this);
//header.setBounds(80,50,1000,30);
//un.setBounds(10,80,500,200);
//li.setBounds(50,10,10,30);
//add(header);
setLayout(new
GridLayout());
add(li);
li.addActionListener(this);
}
public void
windowOpened(WindowEvent ae)
{
System.out.println("open");
}
public void
windowClosed(WindowEvent ae)
{
System.out.println("closed");
}
public void
windowClosing(WindowEvent ae)
{
System.exit(0);
}
public void
windowIconified(WindowEvent ae)
{
System.out.println("iconified");
}
public void
windowDeiconified(WindowEvent ae)
{
System.out.println("deiconified");
}
public void
windowActivated(WindowEvent ae)
{
System.out.println("activated");
}
public void
windowDeactivated(WindowEvent ae)
{
setVisible(false);
}
public void
actionPerformed(ActionEvent ae)
{
if(ae.getSource()==li)
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:JEEVAN");
/*PreparedStatement
st1=con.prepareStatement("create table feedback(uname varchar(20),message
varchar(1000))");
if(st1.execute())
{
JOptionPane.showMessageDialog(this,"Table
created !!!");
}*/
PreparedStatement
st=con.prepareStatement("select * from feedback");
ResultSet
rs=st.executeQuery();
if(rs.next())
{
while(rs.next())
{
String
b="a";
feedbackread page=new
feedbackread(b);
page.setBackground(Color.white);
page.setTitle("Feedbacks");
page.setVisible(true);
page.setSize(20,20);
page.setLayout(new
GridLayout(0,2));
page.setBounds(10,10,1200,768);
JLabel jl2=new
JLabel(rs.getString(1));
JLabel jl3=new
JLabel(rs.getString(2));
page.add(jl2);page.add(jl3);
setVisible(false);
//page.add(li);
}
}
else
{
JOptionPane.showMessageDialog(this,"Incorrect
login or password","Error",JOptionPane.ERROR_MESSAGE);
}
}
catch(Exception e)
{
System.out.println("Error
in "+e.getMessage());
JOptionPane.showMessageDialog(this,"Error
in "+e.getMessage());
}
}
}
public static void
main(String h[])
{
feedbackread page=new
feedbackread();
page.setBackground(Color.white);
page.setTitle("Feedbacks");
page.setVisible(false);
page.setSize(300,200);
page.setLayout(new
GridLayout(0,1));
// page.setBounds(10,10,300,76);
}
}
main.java:
``````````````
import java.awt.*;
import java.awt.event.*;
public class main extends Frame implements
ActionListener,WindowListener
{
private static final
long serialVersionUID = 1L;
Button log=new
Button("Login");
Button reg=new
Button("Registration");
Button adm=new
Button("Admin");
public main()
{
reg.setFont(new
Font("Times New Roman", Font.BOLD,15));
reg.setForeground(Color.blue);
reg.setBackground(Color.white);
log.setFont(new
Font("Times New Roman", Font.BOLD,15));
log.setForeground(Color.blue);
log.setBackground(Color.white);
adm.setFont(new
Font("Times New Roman", Font.BOLD,15));
adm.setForeground(Color.blue);
adm.setBackground(Color.white);
setLayout(null);
addWindowListener(this);
log.setBounds(10,80,500,200);
reg.setBounds(50,240,100,30);
reg.setBounds(90,400,100,30);
add(log);
add(reg);
add(adm);
reg.addActionListener(this);
log.addActionListener(this);
adm.addActionListener(this);
}
public void
windowOpened(WindowEvent ae)
{
System.out.println("open");
}
public void
windowClosed(WindowEvent ae)
{
System.out.println("closed");
}
public void
windowClosing(WindowEvent ae)
{
System.exit(0);
}
public void
windowIconified(WindowEvent ae)
{
System.out.println("iconified");
}
public void
windowDeiconified(WindowEvent ae)
{
System.out.println("deiconified");
}
public void
windowActivated(WindowEvent ae)
{
System.out.println("activated");
}
public void
windowDeactivated(WindowEvent ae)
{
System.out.println("deactivated");
}
public void
actionPerformed(ActionEvent ae)
{
if(ae.getSource()==log)
{
}
else
if(ae.getSource()==reg)
{
}
else
if(ae.getSource()==adm)
{
}
}
public static void
main(String h[])
{
main page=new main();
page.setBackground(Color.white);
page.setTitle("MY
APP");
page.setVisible(true);
page.setSize(300,200);
}
}
main1.java:
``````````````
import java.awt.*;
import java.awt.event.*;
public class main1 extends Frame implements
ActionListener,WindowListener
{
private static final
long serialVersionUID = 1L;
Button log=new
Button("Login");
Button reg=new
Button("Registration");
Button adm=new
Button("Admin");
public main1()
{
reg.setFont(new
Font("Times New Roman", Font.BOLD,15));
reg.setForeground(Color.blue);
reg.setBackground(Color.white);
log.setFont(new
Font("Times New Roman", Font.BOLD,15));
log.setForeground(Color.blue);
log.setBackground(Color.white);
adm.setFont(new
Font("Times New Roman", Font.BOLD,15));
adm.setForeground(Color.blue);
adm.setBackground(Color.white);
setLayout(null);
addWindowListener(this);
log.setBounds(10,50,100,30);
reg.setBounds(110,50,100,30);
adm.setBounds(210,50,100,30);
add(log);
add(reg);
add(adm);
reg.addActionListener(this);
log.addActionListener(this);
adm.addActionListener(this);
}
public void
windowOpened(WindowEvent ae)
{
System.out.println("open");
}
public void
windowClosed(WindowEvent ae)
{
System.out.println("closed");
}
public void
windowClosing(WindowEvent ae)
{
System.exit(0);
}
public void
windowIconified(WindowEvent ae)
{
System.out.println("iconified");
}
public void
windowDeiconified(WindowEvent ae)
{
System.out.println("deiconified");
}
public void
windowActivated(WindowEvent ae)
{
System.out.println("activated");
}
public void
windowDeactivated(WindowEvent ae)
{
System.out.println("deactivated");
}
public void
actionPerformed(ActionEvent ae)
{
if(ae.getSource()==log)
{
setVisible(false);
login page=new
login();
page.setBackground(Color.white);
page.setTitle("Login");
page.setVisible(true);
page.setSize(300,200);
}
else
if(ae.getSource()==reg)
{
setVisible(false);
}
else
if(ae.getSource()==adm)
{
setVisible(false);
admin page=new
admin();
page.setBackground(Color.white);
page.setTitle("Admin
Login");
page.setVisible(true);
page.setSize(300,200);
}
}
public static void
main(String h[])
{
main1 page=new
main1();
page.FEEDBACK SYSTEM USING SWINGS:
````````````````````````````````````````````````````````
admin.java:
~~~~~~~~~
import java.awt.*;
import java.sql.*;
import javax.swing.*;
import java.awt.event.*;
public class admin extends Frame implements
ActionListener,WindowListener
{
private static final
long serialVersionUID = 1L;
TextField un=new
TextField();
TextField pw=new
TextField();
Label un1=new
Label("User Name");
Label pw1=new
Label("Password");
Button li=new
Button("Login");
Button cl=new
Button("Cancel");
public admin()
{
JLabel header=new
JLabel("ADMIN LOGIN");
header.setFont(new
Font("Times New Roman", Font.BOLD,20));
un1.setFont(new
Font("Times New Roman", Font.BOLD,15));
pw1.setFont(new
Font("Times New Roman", Font.BOLD,15));
li.setFont(new
Font("Times New Roman", Font.BOLD,15));
cl.setFont(new
Font("Times New Roman", Font.BOLD,15));
li.setForeground(Color.blue);
cl.setForeground(Color.blue);
li.setBackground(Color.white);
cl.setBackground(Color.white);
setLayout(null);
addWindowListener(this);
header.setBounds(80,50,1000,30);
un1.setBounds(50,80,100,30);
un.setBounds(150,80,100,30);
pw1.setBounds(50,110,100,30);
pw.setBounds(150,110,100,30);
li.setBounds(50,140,100,30);
cl.setBounds(150,140,100,30);
pw.setEchoChar('@');
add(header);
add(un1);add(un);
add(pw1);add(pw);
add(li);add(cl);
li.addActionListener(this);
cl.addActionListener(this);
}
public void
windowOpened(WindowEvent ae)
{
System.out.println("open");
}
public void
windowClosed(WindowEvent ae)
{
System.out.println("closed");
}
public void
windowClosing(WindowEvent ae)
{
System.exit(0);
}
public void
windowIconified(WindowEvent ae)
{
System.out.println("iconified");
}
public void
windowDeiconified(WindowEvent ae)
{
System.out.println("deiconified");
}
public void
windowActivated(WindowEvent ae)
{
System.out.println("activated");
}
public void
windowDeactivated(WindowEvent ae)
{
System.out.println("deactivated");
}
public void
actionPerformed(ActionEvent ae)
{
if(ae.getSource()==li)
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:JEEVAN");
//PreparedStatement
st3=con.prepareStatement("drop table admin");
//if(st3.execute())
//{
// JOptionPane.showMessageDialog(this,"Table
deleted !!!");
//}
//PreparedStatement
st1=con.prepareStatement("create table admin(uname varchar(20),pswd
varchar(20),phoneno varchar(15))");
//if(st1.execute())
//{
// JOptionPane.showMessageDialog(this,"Table
created !!!");
//}
//PreparedStatement
st2=con.prepareStatement("insert into admin values(?,?,?)");
//String
ab="Jayanth";
//String
bc="jayanth";
//String
cd="9611146004";
//st2.setString(1,ab);
//st2.setString(2,bc);
//st2.setString(3,cd);
//if(st2.execute())
//{
// JOptionPane.showMessageDialog(this,"Inserted
!!!");
//}
PreparedStatement
st=con.prepareStatement("select * from admin where uname=? and
pswd=?");
String
a=un.getText();
String
b=pw.getText();
st.setString(1,a);
st.setString(2,b);
ResultSet
rs=st.executeQuery();
if(rs.next())
{
setVisible(false);
JOptionPane.showMessageDialog(this,"Login
Successful !!! Extracting feedbacks......");
feedbackread fb=new
feedbackread();
fb.setVisible(true);
fb.setBackground(Color.white);
fb.setTitle("Feedback
form");
fb.setSize(280,300);
}
else
{
JOptionPane.showMessageDialog(this,"Incorrect
login or password","Error",JOptionPane.ERROR_MESSAGE);
}
}
catch(Exception e)
{
System.out.println("Error
in "+e.getMessage());
JOptionPane.showMessageDialog(this,"Error
in "+e.getMessage());
}
}
else
if(ae.getSource()==cl)
{
setVisible(false);
JOptionPane.showMessageDialog(this,"Cancelled
!!!");
}
}
public static void
main(String h[])
{
admin page=new
admin();
page.setBackground(Color.white);
page.setTitle("Admin
Login");
page.setVisible(true);
page.setSize(300,200);
}
}
feedback.java:
~~~~~~~~~~~~
import java.awt.*;
import java.sql.*;
import javax.swing.*;
import java.awt.event.*;
public class feedback extends Frame implements
ActionListener,WindowListener
{
private static final
long serialVersionUID = 1L;
TextField un=new
TextField();
Label un1=new
Label("Feedback");
Label jl;
Button li=new
Button("Feedback");
Button cl=new
Button("Cancel");
feedback(String a)
{
jl=new Label(a);
un1.setFont(new
Font("Times New Roman", Font.BOLD,15));
li.setFont(new
Font("Times New Roman", Font.BOLD,15));
cl.setFont(new
Font("Times New Roman", Font.BOLD,15));
li.setForeground(Color.blue);
cl.setForeground(Color.blue);
li.setBackground(Color.white);
cl.setBackground(Color.white);
setLayout(null);
addWindowListener(this);
un1.setBounds(50,80,100,30);
un.setBounds(50,110,200,130);
li.setBounds(50,240,100,30);
cl.setBounds(150,240,100,30);
add(un1);add(jl);add(un);
add(li);add(cl);
li.addActionListener(this);
cl.addActionListener(this);
}
public void
windowOpened(WindowEvent ae)
{
System.out.println("open");
}
public void
windowClosed(WindowEvent ae)
{
System.out.println("closed");
}
public void
windowClosing(WindowEvent ae)
{
System.exit(0);
}
public void
windowIconified(WindowEvent ae)
{
System.out.println("iconified");
}
public void
windowDeiconified(WindowEvent ae)
{
System.out.println("deiconified");
}
public void
windowActivated(WindowEvent ae)
{
System.out.println("activated");
}
public void
windowDeactivated(WindowEvent ae)
{
System.out.println("deactivated");
}
public void
actionPerformed(ActionEvent ae)
{
if(ae.getSource()==li)
{
String
a=jl.getText();
String
b=un.getText();
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:JEEVAN");
/*PreparedStatement
st1=con.prepareStatement("delete feedback where uname=?");
st1.setString(1,"Jayanth");
if(st1.execute())
{
JOptionPane.showMessageDialog(this,"deleted
!!!");
}*/
PreparedStatement
st=con.prepareStatement("insert into feedback values(?,?)");
b=un.getText();
st.setString(1,a);
st.setString(2,b);
st.execute();
//if(st.execute())
{
setVisible(false);
JOptionPane.showMessageDialog(this,"Feedback
submitted sucessfully");
}
}
catch(Exception e)
{
System.out.println("Error
in "+e.getMessage());
JOptionPane.showMessageDialog(this,"Error
in "+e.getMessage());
}
}
else
if(ae.getSource()==cl)
{
setVisible(false);
JOptionPane.showMessageDialog(this,"Feedback
Cancelled !!!");
}
}
public static void
main(String h[])
{
login page=new
login();
page.setBackground(Color.white);
page.setTitle("Login");
page.setVisible(true);
page.setSize(300,200);
}
}
feedbackread.java:
`````````````````````````
import java.awt.*;
import java.sql.*;
import javax.swing.*;
import java.awt.event.*;
public class feedbackread extends Frame implements
ActionListener,WindowListener
{
private static final
long serialVersionUID = 1L;
//Panel un=new
Panel();
Button li=new
Button("Refresh");
public feedbackread()
{
///JLabel header=new
JLabel("Feedbacks");
//header.setFont(new
Font("Times New Roman", Font.BOLD,20));
li.setFont(new
Font("Times New Roman", Font.BOLD,15));
li.setForeground(Color.blue);
li.setBackground(Color.white);
setLayout(null);
addWindowListener(this);
//header.setBounds(80,50,1000,30);
//un.setBounds(10,80,500,200);
li.setBounds(50,100,10,30);
//add(header);
setLayout(new
FlowLayout());
add(li);
li.addActionListener(this);
setSize(120,76);
}
public
feedbackread(String a)
{
//JLabel header=new
JLabel("Feedbacks");
//header.setFont(new
Font("Times New Roman", Font.BOLD,20));
li.setFont(new
Font("Times New Roman", Font.BOLD,15));
li.setForeground(Color.blue);
li.setBackground(Color.white);
setLayout(null);
addWindowListener(this);
//header.setBounds(80,50,1000,30);
//un.setBounds(10,80,500,200);
//li.setBounds(50,10,10,30);
//add(header);
setLayout(new
GridLayout());
add(li);
li.addActionListener(this);
}
public void
windowOpened(WindowEvent ae)
{
System.out.println("open");
}
public void
windowClosed(WindowEvent ae)
{
System.out.println("closed");
}
public void
windowClosing(WindowEvent ae)
{
System.exit(0);
}
public void
windowIconified(WindowEvent ae)
{
System.out.println("iconified");
}
public void
windowDeiconified(WindowEvent ae)
{
System.out.println("deiconified");
}
public void
windowActivated(WindowEvent ae)
{
System.out.println("activated");
}
public void
windowDeactivated(WindowEvent ae)
{
setVisible(false);
}
public void
actionPerformed(ActionEvent ae)
{
if(ae.getSource()==li)
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:JEEVAN");
/*PreparedStatement
st1=con.prepareStatement("create table feedback(uname varchar(20),message
varchar(1000))");
if(st1.execute())
{
JOptionPane.showMessageDialog(this,"Table
created !!!");
}*/
PreparedStatement
st=con.prepareStatement("select * from feedback");
ResultSet
rs=st.executeQuery();
if(rs.next())
{
while(rs.next())
{
String
b="a";
feedbackread page=new
feedbackread(b);
page.setBackground(Color.white);
page.setTitle("Feedbacks");
page.setVisible(true);
page.setSize(20,20);
page.setLayout(new
GridLayout(0,2));
page.setBounds(10,10,1200,768);
JLabel jl2=new
JLabel(rs.getString(1));
JLabel jl3=new
JLabel(rs.getString(2));
page.add(jl2);page.add(jl3);
setVisible(false);
//page.add(li);
}
}
else
{
JOptionPane.showMessageDialog(this,"Incorrect
login or password","Error",JOptionPane.ERROR_MESSAGE);
}
}
catch(Exception e)
{
System.out.println("Error
in "+e.getMessage());
JOptionPane.showMessageDialog(this,"Error
in "+e.getMessage());
}
}
}
public static void
main(String h[])
{
feedbackread page=new
feedbackread();
page.setBackground(Color.white);
page.setTitle("Feedbacks");
page.setVisible(false);
page.setSize(300,200);
page.setLayout(new
GridLayout(0,1));
// page.setBounds(10,10,300,76);
}
}
login.java:
````````````
import java.awt.*;
import java.sql.*;
import javax.swing.*;
import java.awt.event.*;
public class feedbackread extends Frame implements
ActionListener,WindowListener
{
private static final
long serialVersionUID = 1L;
//Panel un=new
Panel();
Button li=new
Button("Refresh");
public feedbackread()
{
///JLabel header=new
JLabel("Feedbacks");
//header.setFont(new
Font("Times New Roman", Font.BOLD,20));
li.setFont(new
Font("Times New Roman", Font.BOLD,15));
li.setForeground(Color.blue);
li.setBackground(Color.white);
setLayout(null);
addWindowListener(this);
//header.setBounds(80,50,1000,30);
//un.setBounds(10,80,500,200);
li.setBounds(50,100,10,30);
//add(header);
setLayout(new
FlowLayout());
add(li);
li.addActionListener(this);
setSize(120,76);
}
public
feedbackread(String a)
{
//JLabel header=new
JLabel("Feedbacks");
//header.setFont(new
Font("Times New Roman", Font.BOLD,20));
li.setFont(new
Font("Times New Roman", Font.BOLD,15));
li.setForeground(Color.blue);
li.setBackground(Color.white);
setLayout(null);
addWindowListener(this);
//header.setBounds(80,50,1000,30);
//un.setBounds(10,80,500,200);
//li.setBounds(50,10,10,30);
//add(header);
setLayout(new
GridLayout());
add(li);
li.addActionListener(this);
}
public void
windowOpened(WindowEvent ae)
{
System.out.println("open");
}
public void
windowClosed(WindowEvent ae)
{
System.out.println("closed");
}
public void
windowClosing(WindowEvent ae)
{
System.exit(0);
}
public void
windowIconified(WindowEvent ae)
{
System.out.println("iconified");
}
public void
windowDeiconified(WindowEvent ae)
{
System.out.println("deiconified");
}
public void
windowActivated(WindowEvent ae)
{
System.out.println("activated");
}
public void
windowDeactivated(WindowEvent ae)
{
setVisible(false);
}
public void
actionPerformed(ActionEvent ae)
{
if(ae.getSource()==li)
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:JEEVAN");
/*PreparedStatement
st1=con.prepareStatement("create table feedback(uname varchar(20),message
varchar(1000))");
if(st1.execute())
{
JOptionPane.showMessageDialog(this,"Table
created !!!");
}*/
PreparedStatement
st=con.prepareStatement("select * from feedback");
ResultSet
rs=st.executeQuery();
if(rs.next())
{
while(rs.next())
{
String
b="a";
feedbackread page=new
feedbackread(b);
page.setBackground(Color.white);
page.setTitle("Feedbacks");
page.setVisible(true);
page.setSize(20,20);
page.setLayout(new
GridLayout(0,2));
page.setBounds(10,10,1200,768);
JLabel jl2=new
JLabel(rs.getString(1));
JLabel jl3=new
JLabel(rs.getString(2));
page.add(jl2);page.add(jl3);
setVisible(false);
//page.add(li);
}
}
else
{
JOptionPane.showMessageDialog(this,"Incorrect
login or password","Error",JOptionPane.ERROR_MESSAGE);
}
}
catch(Exception e)
{
System.out.println("Error
in "+e.getMessage());
JOptionPane.showMessageDialog(this,"Error
in "+e.getMessage());
}
}
}
public static void
main(String h[])
{
feedbackread page=new
feedbackread();
page.setBackground(Color.white);
page.setTitle("Feedbacks");
page.setVisible(false);
page.setSize(300,200);
page.setLayout(new
GridLayout(0,1));
// page.setBounds(10,10,300,76);
}
}
main.java:
``````````````
import java.awt.*;
import java.awt.event.*;
public class main extends Frame implements
ActionListener,WindowListener
{
private static final
long serialVersionUID = 1L;
Button log=new
Button("Login");
Button reg=new
Button("Registration");
Button adm=new
Button("Admin");
public main()
{
reg.setFont(new
Font("Times New Roman", Font.BOLD,15));
reg.setForeground(Color.blue);
reg.setBackground(Color.white);
log.setFont(new
Font("Times New Roman", Font.BOLD,15));
log.setForeground(Color.blue);
log.setBackground(Color.white);
adm.setFont(new
Font("Times New Roman", Font.BOLD,15));
adm.setForeground(Color.blue);
adm.setBackground(Color.white);
setLayout(null);
addWindowListener(this);
log.setBounds(10,80,500,200);
reg.setBounds(50,240,100,30);
reg.setBounds(90,400,100,30);
add(log);
add(reg);
add(adm);
reg.addActionListener(this);
log.addActionListener(this);
adm.addActionListener(this);
}
public void
windowOpened(WindowEvent ae)
{
System.out.println("open");
}
public void
windowClosed(WindowEvent ae)
{
System.out.println("closed");
}
public void
windowClosing(WindowEvent ae)
{
System.exit(0);
}
public void
windowIconified(WindowEvent ae)
{
System.out.println("iconified");
}
public void
windowDeiconified(WindowEvent ae)
{
System.out.println("deiconified");
}
public void
windowActivated(WindowEvent ae)
{
System.out.println("activated");
}
public void
windowDeactivated(WindowEvent ae)
{
System.out.println("deactivated");
}
public void
actionPerformed(ActionEvent ae)
{
if(ae.getSource()==log)
{
}
else
if(ae.getSource()==reg)
{
}
else
if(ae.getSource()==adm)
{
}
}
public static void
main(String h[])
{
main page=new main();
page.setBackground(Color.white);
page.setTitle("MY
APP");
page.setVisible(true);
page.setSize(300,200);
}
}
main1.java:
``````````````
import java.awt.*;
import java.awt.event.*;
public class main1 extends Frame implements
ActionListener,WindowListener
{
private static final
long serialVersionUID = 1L;
Button log=new
Button("Login");
Button reg=new
Button("Registration");
Button adm=new
Button("Admin");
public main1()
{
reg.setFont(new
Font("Times New Roman", Font.BOLD,15));
reg.setForeground(Color.blue);
reg.setBackground(Color.white);
log.setFont(new
Font("Times New Roman", Font.BOLD,15));
log.setForeground(Color.blue);
log.setBackground(Color.white);
adm.setFont(new
Font("Times New Roman", Font.BOLD,15));
adm.setForeground(Color.blue);
adm.setBackground(Color.white);
setLayout(null);
addWindowListener(this);
log.setBounds(10,50,100,30);
reg.setBounds(110,50,100,30);
adm.setBounds(210,50,100,30);
add(log);
add(reg);
add(adm);
reg.addActionListener(this);
log.addActionListener(this);
adm.addActionListener(this);
}
public void
windowOpened(WindowEvent ae)
{
System.out.println("open");
}
public void
windowClosed(WindowEvent ae)
{
System.out.println("closed");
}
public void
windowClosing(WindowEvent ae)
{
System.exit(0);
}
public void
windowIconified(WindowEvent ae)
{
System.out.println("iconified");
}
public void
windowDeiconified(WindowEvent ae)
{
System.out.println("deiconified");
}
public void
windowActivated(WindowEvent ae)
{
System.out.println("activated");
}
public void
windowDeactivated(WindowEvent ae)
{
System.out.println("deactivated");
}
public void
actionPerformed(ActionEvent ae)
{
if(ae.getSource()==log)
{
setVisible(false);
login page=new
login();
page.setBackground(Color.white);
page.setTitle("Login");
page.setVisible(true);
page.setSize(300,200);
}
else
if(ae.getSource()==reg)
{
setVisible(false);
}
else
if(ae.getSource()==adm)
{
setVisible(false);
admin page=new
admin();
page.setBackground(Color.white);
page.setTitle("Admin
Login");
page.setVisible(true);
page.setSize(300,200);
}
}
public static void
main(String h[])
{
main1 page=new
main1();
page.setBackground(Color.white);
page.setTitle("MY
APP");
page.setVisible(true);
page.setSize(300,200);
}
}
setBackground(Color.white);
page.setTitle("MY
APP");
page.setVisible(true);
page.setSize(300,200);
}
}