0% found this document useful (0 votes)
123 views17 pages

Sports Club Project

The software manages data for a sports club including members and employees. It allows users to add new members, search for existing members, and view a full list of members. It also keeps records of club employees including name, salary, date of hire, qualifications, and phone number. The software is built with Java Swing and connects to a MySQL database to store and retrieve member and employee data.

Uploaded by

Siddharth Dixit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
123 views17 pages

Sports Club Project

The software manages data for a sports club including members and employees. It allows users to add new members, search for existing members, and view a full list of members. It also keeps records of club employees including name, salary, date of hire, qualifications, and phone number. The software is built with Java Swing and connects to a MySQL database to store and retrieve member and employee data.

Uploaded by

Siddharth Dixit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 17

Sports Club Management

The software manages the data for a sports club. It has options
to manage Vistiors ie Members of the sports club. We can add a
New Member, Search for a specific Visitor and can see list of all
Members of the Club.
It also keeps records of Employess working in the Sports Club.

public class options extends javax.swing.JFrame {


public options()

private void
jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

vistor v=new vistor();


v.setVisible(true);
}

private void
jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
searchVisitor v=new searchVisitor();
v.setVisible(true);

private void
jButton3ActionPerformed(java.awt.event.ActionEvent evt) {

viewvisitors v=new viewvisitors();


v.setVisible(true);
}

private void
jButton4ActionPerformed(java.awt.event.ActionEvent evt) {

addEmployee v=new addEmployee();


v.setVisible(true);
}

private void
jButton5ActionPerformed(java.awt.event.ActionEvent evt) {

showEmp s=new showEmp();


s.setVisible(true);
}

private javax.swing.JButton jButton1;


private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;

}
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import javax.swing.JOptionPane;

public class vistor extends javax.swing.JFrame {

public vistor()
private void
jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
int mp, gp, ta;
mp=Integer.parseInt(t3.getText());
gp=Integer.parseInt(t4.getText());
ta=mp+gp;
t5.setText(""+ta);

{
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost/spor
tsclub","root","");
Statement st=con.createStatement();
String q;
q="insert into visitor values('" + t1.getText() + "'," +
t2.getText() + ",'" + cb1.getSelectedItem().toString() + "','" +
cb2.getSelectedItem().toString() + "'," + t3.getText() + ",'" +
cb3.getSelectedItem().toString() + "'," + t4.getText() + ","+ ta +
")";
st.executeUpdate(q);
JOptionPane.showMessageDialog(null, "Saved!!");
}
catch(Exception y)
{
JOptionPane.showMessageDialog(null, y.toString());

private void cb1ActionPerformed(java.awt.event.ActionEvent


evt) {
int n,d=0;
n=cb1.getSelectedIndex();

if(n==0)
d=100;
else if(n==1)
d=80;
else if(n==2)
d=150;
else if(n==3)
d=120;
else
d=110;
t2.setText(d+"");
}

private void cb2ActionPerformed(java.awt.event.ActionEvent


evt) {
int n,d=0;
n=cb2.getSelectedIndex();

if(n==0)
d=50;
else
d=100;
t3.setText(d+"");
}

private void cb3ActionPerformed(java.awt.event.ActionEvent


evt) {
int n,d=0;
n=cb3.getSelectedIndex();

if(n==0)
d=50;
else if(n==1)
d=50;
else if(n==2)
d=50;
else if(n==3)
d=50;
else
d=50;
t4.setText(d+"");
}

private void
jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
t1.setText("");
t2.setText("");
t3.setText("");
t4.setText("");
t5.setText("");
}

{
public void run() {
new vistor().setVisible(true);
}
});
}

private javax.swing.JComboBox cb1;


private javax.swing.JComboBox cb2;
private javax.swing.JComboBox cb3;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JLabel lab3;
private javax.swing.JTextField t1;
private javax.swing.JTextField t2;
private javax.swing.JTextField t3;
private javax.swing.JTextField t4;
private javax.swing.JTextField t5;

}
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;

public class viewvisitors extends javax.swing.JFrame {

public viewvisitors() {
initComponents();
}
private void
jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost/spor
tsclub","root","");
Statement st=con.createStatement();
String q,amt;
q="select * from visitor";
ResultSet rs=st.executeQuery(q);
DefaultTableModel df=tb1.getModel();
while(rs.next())
{
String n,ag,gen,m, mp, g, gp;
n=rs.getString("name");
ag=rs.getString("age");
gen=rs.getString("gender");
m=rs.getString("membership");
mp=rs.getString("price");
g=rs.getString("game");
gp=rs.getString("priceg");
amt=rs.getString("total");

{
JOptionPane.showMessageDialog(this,y.toString());
}
}

{
public void run() {
new viewvisitors().setVisible(true);

private javax.swing.JButton jButton1;


private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable tb1;

}
import java.sql.*;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;

public class searchVisitor extends javax.swing.JFrame {

public searchVisitor() {
initComponents();
}

private void
jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost/spor
tsclub","root","");
Statement st=con.createStatement();
String q,amt,n;
n=t1.getText();
q="select * from visitor where name='"+ n+"'";
ResultSet rs=st.executeQuery(q);
df=tb1.getModel();
while(rs.next())
{
String ag,gen,m, mp, g, gp;
n=rs.getString("name");
ag=rs.getString("age");
gen=rs.getString("gender");
m=rs.getString("membership");
mp=rs.getString("price");
g=rs.getString("game");
gp=rs.getString("priceg");
amt=rs.getString("total");
String d[]={n,ag,gen,m, mp, g, gp,amt};

{
JOptionPane.showMessageDialog(this,y.toString());
}
}

java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new searchVisitor().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel3;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextField t1;
private javax.swing.JTable tb1;

}
import java.sql.*;
import javax.swing.JOptionPane;
public class addEmployee extends javax.swing.JFrame {

/**
* Creates new form addEmployee
*/
public addEmployee() {
initComponents();
}
private void
jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
String a,b,c,d,e,f,q;
a=t1.getText() ;
b= t2.getText();
c=t3.getText();
d=t4.getText();
e=t5.getText();
f=t6.getText();

try
{
Class.forName("com.mysql.jdbc.Driver");
Connection con =
DriverManager.getConnection("jdbc:mysql://localhost/sportsclu
b","root","");
Statement st = con.createStatement () ;
q="insert into employee values('" + a + "',"+b + ",'" + c +
"','"+d+ "','"+e+"','" + f + "')";
st.executeUpdate(q);
JOptionPane.showMessageDialog(this,"Saved");
}
catch(Exception ex)
{
JOptionPane.showMessageDialog(this,ex.toString());
}
}

private void
jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
t1.setText ("");
t2.setText("");
t3.setText("");
t4.setText("") ;
t5.setText("") ;
t6.setText("");
}

public void run() {


new addEmployee().setVisible(true);
}
});
}
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JTextField t1;
private javax.swing.JTextField t2;
private javax.swing.JTextField t3;
private javax.swing.JTextField t4;
private javax.swing.JTextField t5;
private javax.swing.JTextField t6;
}
import java.sql.*;
import javax.swing.table.DefaultTableModel;
public class showEmp extends javax.swing.JFrame {

public showEmp() {
initComponents();
}
private void
jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

try
{

Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost/spor
tsclub","root","");
Statement st=con.createStatement();
String q,tn,nm,s,d,t,noc;
q="select * from employee";
ResultSet rs=st.executeQuery(q);
DefaultTableModel df=jTable1.getModel();
while(rs.next())
{
tn=rs.getString("name");
nm=rs.getString("salary");
s=rs.getString("doj");
d=rs.getString("qualification");
t=rs.getString("phone");
noc=rs.getString("emailid");
}
}

}
}

You might also like