E-PROJECT REPORT ON TRUTH-NEWS
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
seminar surveyer
Active In SP
**

Posts: 3,541
Joined: Sep 2010
#1
27-01-2011, 04:39 PM





.doc   documantation.doc (Size: 916.5 KB / Downloads: 49)

.zip   Paper_Editor-source code.zip (Size: 883.99 KB / Downloads: 34)


SUBMITTED BY:-
*MALKEET SINGH
*HARPREET SINGH


CENTER:-
*ACE-Rudrapur


PROBLEM STATEMENT


Due to the several discerpancres that occur in their work, they have approached us to provide a solution by incorporating a stand alone application, through which all the work that is to be done by the agency people can be easily managed and also they can overcome the discrepancies that occur in their work.

We are expected to develop a system such that staff can manage the client and administrative details so that, data redundancy is reduced and consistency is made.


SYNOPSIS

The application is developed for Windows platform Using Net Beans 5.0(java swing +jdbc) as a Front-end, Ms Access as a Back-end.


The application performs the following functions:-
 Stores the information for managing TRUTH-NEWS in the database.
 ADMINISTRATOR :-
• View the information of all the clients of all the client details. Such as client id, his name, phone no, address, email etc.
• Information about all the branches which are spread all over the world.
• Register a client.
• Add the Branch.
• Modify & delete the details of client, its branches..


FORM DETAILS

There are total 9 forms in our project and implimentations. The 1st form i.e. LOGIN FORM accepts the user name (admin) and user password (malkeet) and will directly lead to the ADMINISTRATOR LOGIN form. This form in the main form of the project and implimentation that will lead to all the other forms such as client details form, branch details form etc.

The administrator form contains the 3 buttons. All buttons leads to the ADMINISTRATIVE rights such as insert, modify and delete operations rights..

Name of the connectivity (jdbc): news
Name of the Database: paper_editor


CODING:-

Code:
[b]LOGIN _FORM:-[/b]


/*
* Login_Details.java
*
* Created on July 24, 2002, 2:38 PM
*/

package paper_editor;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.swing.JOptionPane;
import java.sql.Statement;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.JPasswordField;
import javax.swing.JComboBox;




/**
*
* @author  aptech
*/
public class Login_Details extends javax.swing.JFrame {
    
    /** Creates new form Login_Details */
    public Login_Details() {
        initComponents();
        urstype=new UserClass();
      //  usrtype=new UserClass();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                          
    private void initComponents() {
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        pfpassword = new javax.swing.JPasswordField();
        btnlogin = new javax.swing.JButton();
        cmbusername = new javax.swing.JComboBox();
        btncancel = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        jLabel1.setFont(new java.awt.Font("Monotype Corsiva", 3, 48));
        jLabel1.setText("Login Screen");

        jLabel2.setFont(new java.awt.Font("Monospaced", 1, 18));
        jLabel2.setText("UserName:");

        jLabel3.setFont(new java.awt.Font("Monospaced", 1, 18));
        jLabel3.setText("Password:");

        btnlogin.setFont(new java.awt.Font("Monospaced", 1, 18));
        btnlogin.setText("LOGIN");
        btnlogin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnloginActionPerformed(evt);
            }
        });
        btnlogin.addAncestorListener(new javax.swing.event.AncestorListener() {
            public void ancestorMoved(javax.swing.event.AncestorEvent evt) {
                btnloginAncestorMoved(evt);
            }
            public void ancestorAdded(javax.swing.event.AncestorEvent evt) {
            }
            public void ancestorRemoved(javax.swing.event.AncestorEvent evt) {
            }
        });

        cmbusername.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "", "admin", "employee" }));

        btncancel.setFont(new java.awt.Font("Monospaced", 1, 18));
        btncancel.setText("CANCEL");
        btncancel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btncancelActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(201, 201, 201)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createSequentialGroup()
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                            .add(jLabel3)
                            .add(jLabel2))
                        .add(20, 20, 20)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(pfpassword, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 182, Short.MAX_VALUE)
                            .add(cmbusername, 0, 182, Short.MAX_VALUE)))
                    .add(layout.createSequentialGroup()
                        .add(48, 48, 48)
                        .add(jLabel1)))
                .add(247, 247, 247))
            .add(layout.createSequentialGroup()
                .add(228, 228, 228)
                .add(btnlogin, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 99, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(54, 54, 54)
                .add(btncancel)
                .addContainerGap(269, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(51, 51, 51)
                .add(jLabel1)
                .add(51, 51, 51)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel2)
                    .add(cmbusername, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel3)
                    .add(pfpassword, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(40, 40, 40)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(btnlogin)
                    .add(btncancel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 33, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(216, Short.MAX_VALUE))
        );
        pack();
    }// </editor-fold>                        

    private void btnloginAncestorMoved(javax.swing.event.AncestorEvent evt) {                                      
// TODO add your handling code here:
    }                                      

    private void btncancelActionPerformed(java.awt.event.ActionEvent evt) {                                          
// TODO add your handling code here:
        System.exit(0);
    }                                        

    private void btnloginActionPerformed(java.awt.event.ActionEvent evt) {                                        
//TODO add your handling code here:
        try
        {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        }
        catch(ClassNotFoundException ex){
            JOptionPane.showMessageDialog(this,ex,"problem",JOptionPane.ERROR_MESSAGE);
        }
        try{
            conn=DriverManager.getConnection("jdbc:odbc:news");
        } catch(SQLException ex){
           JOptionPane.showMessageDialog(this,ex,"problem",JOptionPane.ERROR_MESSAGE);
        }
        
        
        try{
            pstmt=(PreparedStatement)conn.prepareStatement("Select * from login where puser=? AND ppassword=?");
            strusername=(String)cmbusername.getSelectedItem();
            
            char[] ar=pfpassword.getPassword();
                    strpassword= new String(ar);
            pstmt.setString(1,strusername);
            pstmt.setString(2,strpassword);
        }catch(SQLException ex) {
           JOptionPane.showMessageDialog(this,ex,"problem",JOptionPane.ERROR_MESSAGE);  
        }
        try {
            ResultSet rs = pstmt.executeQuery();
            int p=0;
            while(rs.next())
                p++;
            
            if(p==0)
                JOptionPane.showMessageDialog(this,"Invalid username or Invalid password","Message",JOptionPane.ERROR_MESSAGE);
            else{
                JOptionPane.showMessageDialog(this,"Success","Message",JOptionPane.INFORMATION_MESSAGE);
             if(strusername.equals("admin"))
            {
                Administrator_login wh = new Administrator_login();
               UserClass.username = "admin";
                wh.setVisible(true);
                setVisible(false);
            }
            if(strusername.equals("employee")){
                Client_Details wh = new Client_Details();
                UserClass.username = "employee";
                wh.setVisible(true);
                setVisible(false);
            }
            }
            conn.close();
        }catch(SQLException ex){
          JOptionPane.showMessageDialog(this,ex,"problem",JOptionPane.ERROR_MESSAGE);
        }
    
    }                                        

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Login_Details().setVisible(true);
            }
        });
    }
    
    // Variables declaration - do not modify                    
    private javax.swing.JButton btncancel;
    private javax.swing.JButton btnlogin;
    private javax.swing.JComboBox cmbusername;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JPasswordField pfpassword;
    // End of variables declaration                  

    Connection conn;
    PreparedStatement pstmt;
    String strusertype,strusername,strpassword;

    private UserClass urstype;
    UserClass usrtype;

    //private UserClass usrtype;

  
}


[b]ADMINISTRATOR LOGIN  FORM[/b]


/*
* Administrator_login.java
*
* Created on July 24, 2002, 2:41 PM
*/

package paper_editor;

/**
*
* @author  aptech
*/
public class Administrator_login extends javax.swing.JFrame {
    
    /** Creates new form Administrator_login */
    public Administrator_login() {
        initComponents();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                          
    private void initComponents() {
        btnemployee = new javax.swing.JButton();
        btnclient = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        btnbranch = new javax.swing.JButton();
        jLabel6 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        btnemployee.setIcon(new javax.swing.ImageIcon("C:\\Documents and Settings\\Administrator\\Desktop\\bb.JPG"));
        btnemployee.setText("Employee");
        btnemployee.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 5));
        btnemployee.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnemployeeActionPerformed(evt);
            }
        });

        btnclient.setIcon(new javax.swing.ImageIcon("C:\\Documents and Settings\\Administrator\\Desktop\\bb.JPG"));
        btnclient.setText("Client");
        btnclient.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 5));
        btnclient.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnclientActionPerformed(evt);
            }
        });

        jLabel1.setFont(new java.awt.Font("Castellar", 3, 48));
        jLabel1.setText("TRUTH TODAY");

        jLabel2.setFont(new java.awt.Font("Castellar", 3, 48));
        jLabel2.setText("WELCOME");

        jLabel3.setIcon(new javax.swing.ImageIcon("C:\\Documents and Settings\\Administrator\\Desktop\\bb.JPG"));
        jLabel3.setText("jLabel3");

        jLabel4.setFont(new java.awt.Font("Monotype Corsiva", 3, 24));
        jLabel4.setText("Employee");

        jLabel5.setFont(new java.awt.Font("Monotype Corsiva", 3, 24));
        jLabel5.setText("Client");

        btnbranch.setIcon(new javax.swing.ImageIcon("C:\\Documents and Settings\\Administrator\\Desktop\\bb.JPG"));
        btnbranch.setText("Client");
        btnbranch.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 5));
        btnbranch.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnbranchActionPerformed(evt);
            }
        });

        jLabel6.setFont(new java.awt.Font("Monotype Corsiva", 3, 24));
        jLabel6.setText("Branch");

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(jLabel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 105, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(10, 10, 10)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createSequentialGroup()
                        .add(35, 35, 35)
                        .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 450, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(layout.createSequentialGroup()
                        .add(112, 112, 112)
                        .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 308, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(214, Short.MAX_VALUE))
            .add(layout.createSequentialGroup()
                .addContainerGap(74, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(layout.createSequentialGroup()
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(btnemployee, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 118, Short.MAX_VALUE))
                    .add(jLabel4))
                .add(116, 116, 116)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(layout.createSequentialGroup()
                        .add(jLabel5)
                        .add(29, 29, 29))
                    .add(layout.createSequentialGroup()
                        .add(btnclient, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 119, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(3, 3, 3)))
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createSequentialGroup()
                        .add(94, 94, 94)
                        .add(jLabel6))
                    .add(layout.createSequentialGroup()
                        .add(65, 65, 65)
                        .add(btnbranch, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 116, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .add(203, 203, 203))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createSequentialGroup()
                        .add(24, 24, 24)
                        .add(jLabel1)
                        .add(18, 18, 18)
                        .add(jLabel2))
                    .add(layout.createSequentialGroup()
                        .addContainerGap()
                        .add(jLabel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 122, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .add(68, 68, 68)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(btnemployee)
                    .add(btnclient)
                    .add(btnbranch))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel4)
                    .add(jLabel5)
                    .add(jLabel6))
                .add(128, 128, 128))
        );
        pack();
    }// </editor-fold>                        

    private void btnbranchActionPerformed(java.awt.event.ActionEvent evt) {                                          
// TODO add your handling code here:
        setVisible(false);
        Branch_details obj = new Branch_details();
        obj.setVisible(true);
    }                                        

    private void btnclientActionPerformed(java.awt.event.ActionEvent evt) {                                          
// TODO add your handling code here:
        setVisible(false);
        Client_Details obj = new Client_Details();
        obj.setVisible(true);
    }                                        

    private void btnemployeeActionPerformed(java.awt.event.ActionEvent evt) {                                            
// TODO add your handling code here:
        setVisible(false);
        Employee_login obj = new Employee_login();
        obj.setVisible(true);
    }                                          
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Administrator_login().setVisible(true);
            }
        });
    }
    
    // Variables declaration - do not modify                    
    private javax.swing.JButton btnbranch;
    private javax.swing.JButton btnclient;
    private javax.swing.JButton btnemployee;
    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;
    // End of variables declaration                  
    

[b]EMPLOYEE LOGIN FORM[/b]


package paper_editor;

/**
*
* @author  aptech
*/
public class Employee_login extends javax.swing.JFrame {
    
    /** Creates new form Employee_login */
    public Employee_login() {
        initComponents();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                          
    private void initComponents() {
        btnclient = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        btnclient.setIcon(new javax.swing.ImageIcon("D:\\Documents and Settings\\aptech\\Desktop\\CAE8FT8M.jpg"));
        btnclient.setText("Client");
        btnclient.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 5));
        btnclient.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnclientActionPerformed(evt);
            }
        });

        jLabel1.setFont(new java.awt.Font("Castellar", 3, 48));
        jLabel1.setText("TRUTH TODAY");

        jLabel2.setFont(new java.awt.Font("Castellar", 3, 48));
        jLabel2.setText("WELCOME");

        jLabel3.setIcon(new javax.swing.ImageIcon("D:\\Documents and Settings\\aptech\\Desktop\\CAE8FT8M.jpg"));
        jLabel3.setText("jLabel3");

        jLabel4.setFont(new java.awt.Font("Monotype Corsiva", 3, 24));
        jLabel4.setText("Client");

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .addContainerGap(180, Short.MAX_VALUE)
                .add(jLabel1)
                .add(144, 144, 144))
            .add(layout.createSequentialGroup()
                .add(226, 226, 226)
                .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 298, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(239, Short.MAX_VALUE))
            .add(jLabel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 115, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
            .add(layout.createSequentialGroup()
                .add(267, 267, 267)
                .add(btnclient, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 122, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(374, Short.MAX_VALUE))
            .add(layout.createSequentialGroup()
                .add(296, 296, 296)
                .add(jLabel4)
                .addContainerGap(410, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createSequentialGroup()
                        .addContainerGap()
                        .add(jLabel1)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jLabel2)
                        .add(54, 54, 54)
                        .add(btnclient))
                    .add(jLabel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 122, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(17, 17, 17)
                .add(jLabel4)
                .addContainerGap(167, Short.MAX_VALUE))
        );
        pack();
    }// </editor-fold>                        

    private void btnclientActionPerformed(java.awt.event.ActionEvent evt) {                                          
// TODO add your handling code here:
        setVisible(false);
        Client_Details obj = new Client_Details();
        obj.setVisible(true);
    }                                        
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Employee_login().setVisible(true);
            }
        });
    }
    
    // Variables declaration - do not modify                    
    private javax.swing.JButton btnclient;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    // End of variables declaration                  
    
}


[b]CLIENT DETAILS[/b]


/*
* Client_Details.java
*
* Created on July 24, 2002, 2:15 PM
*/

package paper_editor;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.swing.JFormattedTextField;
import javax.swing.JOptionPane;
import javax.swing.text.MaskFormatter;
import java.sql.Statement;


/**
*
* @author  aptech
*/
public class Client_Details extends javax.swing.JFrame {
    
    /** Creates new form Client_Details */
    public Client_Details() {
        initComponents();
       records=new String[30][30];
        refresh();
    }
    public void refresh()
    {
        try
        {  
            try
            {
                try {
                    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                } catch (ClassNotFoundException ex) {
                    System.out.println("cannot find driver");
                    ex.printStackTrace();
                }
                conn=DriverManager.getConnection("jdbc:odbc:news");
                pstmt=(PreparedStatement)conn.prepareStatement("select * from client_details");
            }
            catch(SQLException ae)
            {
                ae.printStackTrace();
            }
            ResultSet rs=pstmt.executeQuery();
            i=0;
            while(rs.next())
            {
                try
                {
                    String id=rs.getString(1);
                    String name=rs.getString(2);
                    String add=rs.getString(3);
                    String gen=rs.getString(4);
                    int phone=rs.getInt(5);
                    int mobile=rs.getInt(6);
                    records[i][0]=id;
                    records[i][1]=name;
                    records[i][2]=add;
                    records[i][3]=gen;
                    records[i][4]=Integer.toString(phone);
                    records[i][5]=Integer.toString(mobile);
                    i++;
                }
                catch(Exception ex)
                {
                     JOptionPane.showMessageDialog(this,"Cannot go to next record","Truth News",JOptionPane.ERROR_MESSAGE);
                }
            }
            nor=i;
            i=0;
            txtid.setText(records[i][0]);
            txtname.setText(records[i][1]);
            txtaddress.setText(records[i][2]);
            if(records[i][3].equalsIgnoreCase("Male"))
            {
                rdbmale.setSelected(true);
            }
            else
            {
                rdbfemale.setSelected(true);
            }
            txfphone.setText(records[i][4]);
            txfmobile.setText(records[i][5]);
        }
        catch(SQLException ae)
        {
            JOptionPane.showMessageDialog(this,"SQL Exception","Truth News",JOptionPane.ERROR_MESSAGE);
        }
        try
        {
            conn.close();
        }
        catch(SQLException ae)
        {
            ae.printStackTrace();
        }
        i=0;
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                          
    private void initComponents() {
        buttonGroup1 = new javax.swing.ButtonGroup();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        btnaddnew = new javax.swing.JButton();
        btnedit = new javax.swing.JButton();
        btndelete = new javax.swing.JButton();
        btnsave = new javax.swing.JButton();
        btncancel = new javax.swing.JButton();
        btnexit = new javax.swing.JButton();
        txtid = new javax.swing.JTextField();
        txtaddress = new javax.swing.JTextField();
        txtname = new javax.swing.JTextField();
        rdbmale = new javax.swing.JRadioButton();
        rdbfemale = new javax.swing.JRadioButton();
        try
        {
            txfphone=new JFormattedTextField(new MaskFormatter("#####-######"));
        }
        catch(java.text.ParseException e)
        {
            e.printStackTrace();
        }
        txfphone = new javax.swing.JFormattedTextField();
        txfmobile = new javax.swing.JFormattedTextField();
        jLabel9 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        jLabel1.setFont(new java.awt.Font("Monotype Corsiva", 3, 48));
        jLabel1.setText("Client Details");

        jLabel2.setFont(new java.awt.Font("Monospaced", 1, 18));
        jLabel2.setText("Id:");

        jLabel3.setFont(new java.awt.Font("Monospaced", 1, 18));
        jLabel3.setText("Address:");

        jLabel4.setFont(new java.awt.Font("Monospaced", 1, 18));
        jLabel4.setText("Phone No:");

        jLabel5.setFont(new java.awt.Font("Monospaced", 1, 18));
        jLabel5.setText("Name:");

        jLabel6.setFont(new java.awt.Font("Monospaced", 1, 18));
        jLabel6.setText("Gender:");

        jLabel7.setFont(new java.awt.Font("Monospaced", 1, 18));
        jLabel7.setText("Mobile No:");

        btnaddnew.setFont(new java.awt.Font("Monospaced", 1, 18));
        btnaddnew.setText("ADD NEW");
        btnaddnew.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnaddnewActionPerformed(evt);
            }
        });

        btnedit.setFont(new java.awt.Font("Monospaced", 1, 18));
        btnedit.setText("EDIT");
        btnedit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btneditActionPerformed(evt);
            }
        });

        btndelete.setFont(new java.awt.Font("Monospaced", 1, 18));
        btndelete.setText("DELETE");
        btndelete.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btndeleteActionPerformed(evt);
            }
        });

        btnsave.setFont(new java.awt.Font("Monospaced", 1, 18));
        btnsave.setText("SAVE");
        btnsave.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnsaveActionPerformed(evt);
            }
        });

        btncancel.setFont(new java.awt.Font("Monospaced", 1, 18));
        btncancel.setText("CANCEL");
        btncancel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btncancelActionPerformed(evt);
            }
        });

        btnexit.setFont(new java.awt.Font("Monospaced", 1, 18));
        btnexit.setText("EXIT");
        btnexit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnexitActionPerformed(evt);
            }
        });

        buttonGroup1.add(rdbmale);
        rdbmale.setFont(new java.awt.Font("Monospaced", 1, 18));
        rdbmale.setText("Male");
        rdbmale.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        rdbmale.setMargin(new java.awt.Insets(0, 0, 0, 0));
        rdbmale.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                rdbmaleItemStateChanged(evt);
            }
        });
        rdbmale.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                rdbmaleStateChanged(evt);
            }
        });

        buttonGroup1.add(rdbfemale);
        rdbfemale.setFont(new java.awt.Font("Monospaced", 1, 18));
        rdbfemale.setText("Female");
        rdbfemale.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        rdbfemale.setMargin(new java.awt.Insets(0, 0, 0, 0));
        rdbfemale.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                rdbfemaleItemStateChanged(evt);
            }
        });

        jLabel9.setIcon(new javax.swing.ImageIcon("C:\\Documents and Settings\\Administrator\\Desktop\\bb.JPG"));
        jLabel9.setText("jLabel3");

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                        .add(layout.createSequentialGroup()
                            .addContainerGap(55, Short.MAX_VALUE)
                            .add(btnaddnew)
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                            .add(btnedit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 106, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                            .add(btndelete)
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                            .add(btnsave, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 104, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(10, 10, 10)
                            .add(btncancel)
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                            .add(btnexit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 95, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
                            .add(95, 95, 95)
                            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                .add(jLabel2)
                                .add(jLabel4)
                                .add(jLabel3))
                            .add(14, 14, 14)
                            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel1)
                                .add(layout.createSequentialGroup()
                                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                                        .add(txfphone)
                                        .add(txtaddress)
                                        .add(txtid, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 183, Short.MAX_VALUE))
                                    .add(25, 25, 25)
                                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                        .add(jLabel7)
                                        .add(jLabel5)
                                        .add(jLabel6))))
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                                .add(txfmobile)
                                .add(txtname)
                                .add(layout.createSequentialGroup()
                                    .add(rdbmale)
                                    .add(16, 16, 16)
                                    .add(rdbfemale)))))
                    .add(jLabel9, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 105, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(45, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(jLabel1)
                .add(60, 60, 60)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createSequentialGroup()
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel2)
                            .add(txtid, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel3)
                            .add(txtaddress, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel4)
                            .add(txfphone, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(jLabel7)))
                    .add(layout.createSequentialGroup()
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel5)
                            .add(txtname, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel6)
                            .add(rdbmale)
                            .add(rdbfemale))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(txfmobile, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 141, Short.MAX_VALUE)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(btncancel)
                    .add(btnexit)
                    .add(btnedit)
                    .add(btndelete)
                    .add(btnsave)
                    .add(btnaddnew))
                .add(99, 99, 99))
            .add(jLabel9, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 122, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
        );
        pack();
    }// </editor-fold>                        

    private void rdbfemaleItemStateChanged(java.awt.event.ItemEvent evt) {                                          
// TODO add your handling code here:
         if(rdbfemale.isSelected()==true)
            strgen="female";
    }                                          

    private void rdbmaleItemStateChanged(java.awt.event.ItemEvent evt) {                                        
// TODO add your handling code here:
        if(rdbmale.isSelected()==true)
            strgen="male";
    }                                        

    private void rdbmaleStateChanged(javax.swing.event.ChangeEvent evt) {                                    
// TODO add your handling code here:
    }                                    

    private void btncancelActionPerformed(java.awt.event.ActionEvent evt) {                                          
// TODO add your handling code here:
       txtid.setText(" ");
       txtname.setText(" ");
       txtaddress.setText(" ");
       txfphone.setText(" ");
       txfmobile.setText(" ");
       txtid.requestFocus();
    }                                        

    private void btnsaveActionPerformed(java.awt.event.ActionEvent evt) {                                        
        PreparedStatement pstmt = null;
        Connection conn = null;
        if(rdbmale.isSelected())
            strgender="male";
        else
            strgender="Female";
// TODO add your handling code here:
        /*Id = (String)txtid.getText();
        Name = (String)txtname.getText();
        Address = (String)txtaddress.getText();
        Male = (String)rdbmale.getText();
        Female = (String)rdbfemale.getText();
        txfphone = (String)txtphoneno.getText();
        mobile_no = (String)txtmobileno.getText();*/
        try
        {
            try
            {
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            }
            catch(ClassNotFoundException ex)
            {
                ex.printStackTrace();
            }
            try
            {
             conn = DriverManager.getConnection("jdbc:odbc:news");
            }
            catch(SQLException ae)
            {
                JOptionPane.showMessageDialog(this,ae+"Database problem","Truth News",JOptionPane.ERROR_MESSAGE);
            }
            int p=0;
            try
            {
                pstmt=conn.prepareStatement("Insert into client_details values(?,?,?,?,?,?)");
                pstmt.setString(1,txtid.getText());
                pstmt.setString(2,txtname.getText());
                pstmt.setString(3,txtaddress.getText());
                pstmt.setString(4,strgender);
                pstmt.setString(5,txfphone.getText());
                pstmt.setString(6,txfmobile.getText());
              
            }
            catch(SQLException ae)
            {
                JOptionPane.showMessageDialog(this,"44 Database problem","Truth News",JOptionPane.ERROR_MESSAGE);
            }
            try
            {
                p=pstmt.executeUpdate();
                p=1;
                if(p==1)
                {
                    JOptionPane.showMessageDialog(this,"Record inserted successfully","Truth News",JOptionPane.PLAIN_MESSAGE);
                     btnedit.setEnabled(true);
                     btndelete.setEnabled(true);
                    btnsave.setEnabled(true);
                    btncancel.setEnabled(true);
                    btnexit.setEnabled(true);
                     btnaddnew.setEnabled(true);
                }
                else
                {
                    JOptionPane.showMessageDialog(this,"Sorry record cannot be inserted","Truth News",JOptionPane.ERROR_MESSAGE);
                }
            }
           catch(SQLException ae)
            {
               JOptionPane.showMessageDialog(this,ae+"55 Database problem","Truth News",JOptionPane.ERROR_MESSAGE);
            }
    }
        catch(Exception ae)
        {
            JOptionPane.showMessageDialog(this," Problem has occured","Truth News",JOptionPane.ERROR_MESSAGE);
        }
            try
            {
                conn.close();
            }
            catch(SQLException ae)
            {
                JOptionPane.showMessageDialog(this,"66 Database problem","Truth News",JOptionPane.ERROR_MESSAGE);
            }
        if(result==JOptionPane.CANCEL_OPTION)
        {
            System.exit(0);
        }
    }                                      

    private void btndeleteActionPerformed(java.awt.event.ActionEvent evt) {                                          
// TODO add your handling code here:
        try
        {
            try
            {
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            }
            catch(ClassNotFoundException ex)
            {
                ex.printStackTrace();
            }
            Connection conn = DriverManager.getConnection("jdbc:odbc:news");
            pstmt = (java.sql.PreparedStatement)conn.prepareStatement("Delete From client_details Where cid=?");
            pstmt.setInt(1,Integer.parseInt(txtid.getText()));
            int t = pstmt.executeUpdate();
            txtid.setText(" ");
            txtname.setText(" ");
            txtaddress.setText(" ");
            txfphone.setText(" ");
            txfmobile.setText(" ");
            if(t==0)
            {
                JOptionPane.showMessageDialog(this,"Cannot Delete","Problem",JOptionPane.ERROR_MESSAGE);
            }
            else
            {
                JOptionPane.showMessageDialog(this,"Records Delete Successfully","SUCCESS",JOptionPane.PLAIN_MESSAGE);
            }
        }
        catch(Exception e) {}
    }                                        

    private void btneditActionPerformed(java.awt.event.ActionEvent evt) {                                        
//        String strgender;
// TODO add your handling code here:
      try
      {
            try
            {
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            }
            catch(ClassNotFoundException ae)
            {
            ae.printStackTrace();
            }
            try
            {
                conn=DriverManager.getConnection("jdbc:odbc:news");
            }
            catch(SQLException ae)
            {
                ae.printStackTrace();
            }
            catch(Exception ae)
            {
                ae.printStackTrace();
            }
    //Connection conn = DriverManager.getConnection("jdbc:odbc:news");
    pstmt = (java.sql.PreparedStatement)conn.prepareStatement("Update client_details set cid=?, cname=?, caddress=?, cgender=?, cphone_no=?, cmobile_no =? where cid=?");
    pstmt.setInt(1,Integer.parseInt(txtid.getText()));
    pstmt.setString(2,txtname.getText());
    pstmt.setString(3,txtaddress.getText());
    pstmt.setString(4,strgen);
    pstmt.setInt(5,Integer.parseInt(txfphone.getText()));    
    pstmt.setInt(6,Integer.parseInt(txfmobile.getText()));
    pstmt.setInt(7,Integer.parseInt(txtid.getText()));
    int t=0;
   t = pstmt.executeUpdate();
    if(t==0)
        JOptionPane.showMessageDialog(this,"Cannot Modify the Record","Problem",JOptionPane.ERROR_MESSAGE);
    else
        JOptionPane.showMessageDialog(this,"Record Modified Successfully","SUCCESS",JOptionPane.PLAIN_MESSAGE);
    }
      catch(SQLException ae)
    {
          JOptionPane.showMessageDialog(this,"TRAPPED 11==> "+ ae + ae.getStackTrace() ,"Problem",JOptionPane.ERROR_MESSAGE);
    }
    catch(Exception ae)
    {
        JOptionPane.showMessageDialog(this,"TRAPPED ==> "+ ae.getMessage() + ae.getStackTrace() ,"Problem",JOptionPane.ERROR_MESSAGE);
    }
      try
      {
          conn.close();
      }
      catch(Exception ae)
      {
          ae.printStackTrace();
      }
    
      if(result==JOptionPane.CANCEL_OPTION)
        {
        System.exit(0);
        
    }                                      
    }  
    private void btnexitActionPerformed(java.awt.event.ActionEvent evt) {                                        
// TODO add your handling code here:
        System.exit(0);
    }                                      

    private void btnaddnewActionPerformed(java.awt.event.ActionEvent evt) {                                          
// TODO add your handling code here:
        btnedit.setEnabled(false);
        btndelete.setEnabled(true);
        btnsave.setEnabled(true);
        btncancel.setEnabled(false);
        btnexit.setEnabled(false);
        btnaddnew.setEnabled(false);
        txtid.setText("");
        txtname.setText("");
        txtaddress.setText("");
        txfphone.setText("");
        txfmobile.setText("");
        txtid.requestFocus();
    }                                        
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Client_Details().setVisible(true);
            }
        });
    }
    
    // Variables declaration - do not modify                    
    private javax.swing.JButton btnaddnew;
    private javax.swing.JButton btncancel;
    private javax.swing.JButton btndelete;
    private javax.swing.JButton btnedit;
    private javax.swing.JButton btnexit;
    private javax.swing.JButton btnsave;
    private javax.swing.ButtonGroup buttonGroup1;
    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.JLabel jLabel9;
    private javax.swing.JRadioButton rdbfemale;
    private javax.swing.JRadioButton rdbmale;
    private javax.swing.JFormattedTextField txfmobile;
    private javax.swing.JFormattedTextField txfphone;
    private javax.swing.JTextField txtaddress;
    private javax.swing.JTextField txtid;
    private javax.swing.JTextField txtname;
    // End of variables declaration                  

    PreparedStatement pstmt;
int p;
     String strgen,Id;
String items;


  


    private String strgender;

    private int result;

    private String[][] records;

    Statement stmt;

    private Connection conn;

    private String item;

    private int i;

  

    private int nor;

    private String phone_no;

    private String Address;

    private String Male;

    private String Phone_no;

    private String Name;

    private String Female;

    private String Mobile_no;

    private String mobile_no;
    
}


[b]BRANCH DETAILS:-[/b]


/*
* Branch_details.java
*
* Created on July 24, 2002, 1:53 PM
*/

package paper_editor;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.swing.JOptionPane;

/**
*
* @author  aptech
*/
public class Branch_details extends javax.swing.JFrame {
    
    /** Creates new form Branch_details */
    public Branch_details() {
        initComponents();
        operation="";
       records=new String[30][30];
        refresh();
    }
    public void refresh()
    {
        try
        {  
            try
            {
                try {
                    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                } catch (ClassNotFoundException ex) {
                    System.out.println("cannot find driver");
                    ex.printStackTrace();
                }
                conn=DriverManager.getConnection("jdbc:odbc:news");
                pstmt=(PreparedStatement)conn.prepareStatement("select * from Branch_details");
            }
            catch(SQLException ae)
            {
                ae.printStackTrace();
            }
            ResultSet rs=pstmt.executeQuery();
            i=0;
            while(rs.next())
            {
                try
                {
                    String state=rs.getString(1);
                    String address=rs.getString(2);
                    String name=rs.getString(3);
                    String be_mail=rs.getString(4);
                    int bphone_no=rs.getInt(5);
                    int hphone_no=rs.getInt(6);
                    String e_mail=rs.getString(7);
                    int hmobile_no=rs.getInt(8);
                    records[i][0]=state;
                    records[i][1]=address;
                    records[i][2]=name;
                    records[i][3]=be_mail;
                    records[i][4]=Integer.toString(bphone_no);
                    records[i][5]=Integer.toString(hphone_no);
                    records[i][6]=e_mail;
                    records[i][7]=Integer.toString(hmobile_no);
                    i++;
                }
                catch(Exception ex)
                {
                     JOptionPane.showMessageDialog(this,"Cannot go to next record","Truth News",JOptionPane.ERROR_MESSAGE);
                }
            }
            nor=i;
            i=0;
            txtstate.setText(records[i][0]);
            txtaddress.setText(records[i][1]);
            txtname.setText(records[i][2]);
            txtbemail.setText(records[i][3]);
            txfphone.setText(records[i][4]);
            txfphoneno.setText(records[i][5]);
            txtemail.setText(records[i][6]);
            txfmobile.setText(records[i][7]);
        }
        catch(SQLException ae)
        {
            JOptionPane.showMessageDialog(this,"SQL Exception","Truth News",JOptionPane.ERROR_MESSAGE);
        }
        try
        {
            conn.close();
        }
        catch(SQLException ae)
        {
            ae.printStackTrace();
        }
        i=0;
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                          
    private void initComponents() {
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        btnaddnew = new javax.swing.JButton();
        btnedit = new javax.swing.JButton();
        btndelete = new javax.swing.JButton();
        btnsave = new javax.swing.JButton();
        btncancel = new javax.swing.JButton();
        btnexit = new javax.swing.JButton();
        txtstate = new javax.swing.JTextField();
        txtbemail = new javax.swing.JTextField();
        txtname = new javax.swing.JTextField();
        txtemail = new javax.swing.JTextField();
        txtaddress = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        txfphone = new javax.swing.JFormattedTextField();
        txfphoneno = new javax.swing.JFormattedTextField();
        txfmobile = new javax.swing.JFormattedTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        jLabel1.setFont(new java.awt.Font("Monotype Corsiva", 3, 48));
        jLabel1.setText("Branch Details");

        jLabel2.setFont(new java.awt.Font("Monospaced", 1, 18));
        jLabel2.setText("State:");

        jLabel3.setFont(new java.awt.Font("Monospaced", 1, 18));
        jLabel3.setText("Branch e_mail:");

        jLabel4.setFont(new java.awt.Font("Monospaced", 1, 18));
        jLabel4.setText("Head Name:");

        jLabel5.setFont(new java.awt.Font("Monospaced", 1, 18));
        jLabel5.setText("E_Mail:");

        jLabel6.setFont(new java.awt.Font("Monospaced", 1, 18));
        jLabel6.setText("Address:");

        jLabel7.setFont(new java.awt.Font("Monospaced", 1, 18));
        jLabel7.setText("Branch phone_no:");

        jLabel8.setFont(new java.awt.Font("Monospaced", 1, 18));
        jLabel8.setText("Head phone_no:");

        jLabel9.setFont(new java.awt.Font("Monospaced", 1, 18));
        jLabel9.setText("Head mobile_no:");

        btnaddnew.setFont(new java.awt.Font("Monospaced", 1, 18));
        btnaddnew.setText("ADD NEW");
        btnaddnew.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnaddnewActionPerformed(evt);
            }
        });

        btnedit.setFont(new java.awt.Font("Monospaced", 1, 18));
        btnedit.setText("EDIT");
        btnedit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btneditActionPerformed(evt);
            }
        });

        btndelete.setFont(new java.awt.Font("Monospaced", 1, 18));
        btndelete.setText("DELETE");
        btndelete.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btndeleteActionPerformed(evt);
            }
        });

        btnsave.setFont(new java.awt.Font("Monospaced", 1, 18));
        btnsave.setText("SAVE");
        btnsave.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnsaveActionPerformed(evt);
            }
        });

        btncancel.setFont(new java.awt.Font("Monospaced", 1, 18));
        btncancel.setText("CANCEL");
        btncancel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btncancelActionPerformed(evt);
            }
        });

        btnexit.setFont(new java.awt.Font("Monospaced", 1, 18));
        btnexit.setText("EXIT");
        btnexit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnexitActionPerformed(evt);
            }
        });

        jLabel10.setIcon(new javax.swing.ImageIcon("D:\\Documents and Settings\\aptech\\Desktop\\CAE8FT8M.jpg"));
        jLabel10.setText("jLabel3");

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createSequentialGroup()
                        .add(220, 220, 220)
                        .add(jLabel1))
                    .add(layout.createSequentialGroup()
                        .add(114, 114, 114)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                .add(jLabel2)
                                .add(jLabel3)
                                .add(jLabel4)
                                .add(jLabel5))
                            .add(btnaddnew))
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(layout.createSequentialGroup()
                                .add(22, 22, 22)
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                                    .add(txtemail)
                                    .add(txtname)
                                    .add(txtbemail)
                                    .add(txtstate, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 186, Short.MAX_VALUE)))
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                                .add(6, 6, 6)
                                .add(btnedit, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 97, Short.MAX_VALUE)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(btndelete)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(layout.createSequentialGroup()
                                .add(51, 51, 51)
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(jLabel7)
                                    .add(jLabel6)
                                    .add(jLabel8)
                                    .add(jLabel9))
                                .add(24, 24, 24)
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                                    .add(txfmobile)
                                    .add(txfphoneno)
                                    .add(txfphone)
                                    .add(txtaddress, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 180, Short.MAX_VALUE)))
                            .add(layout.createSequentialGroup()
                                .add(6, 6, 6)
                                .add(btnsave, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 95, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(btncancel)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(btnexit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 93, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))))
                .add(203, 203, 203))
            .add(jLabel10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 115, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page

Quick Reply
Message
Type your reply to this message here.


Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  WCPS Web Based Claims Processing System A PROJECT REPORT study tips 1 472 05-04-2016, 12:33 PM
Last Post: mkaasees
  Project Report On OnLine Cab Service project girl 1 952 22-08-2014, 07:29 PM
Last Post: HKGSuIeNq
  ONLINE CHAT SERVER PROJECT REPORT study tips 2 1,948 10-01-2014, 01:59 PM
Last Post: seminar project topic
  EXAM REGISTRATION SYSTEM A MINI PROJECT REPORT project girl 2 2,587 05-10-2013, 06:51 AM
Last Post: Guest
  Project Report On Examination Management System pdf seminar projects maker 0 710 28-09-2013, 04:00 PM
Last Post: seminar projects maker
  SURA Project Monitors Report seminar projects maker 0 299 25-09-2013, 12:26 PM
Last Post: seminar projects maker
  A Project Report on TELEPHONE BILLING SYSTEM seminar projects maker 0 518 13-09-2013, 12:35 PM
Last Post: seminar projects maker
  ONTOLOGY BASED DATA SHARING WITH CRYTOGRAPHY PROJECT REPORT seminar projects maker 0 431 13-09-2013, 11:36 AM
Last Post: seminar projects maker
  A PROJECT REPORT ON TOURS AND TRAVELS ONLINE TICKET BOOKING SYSTEM study tips 0 405 10-09-2013, 04:35 PM
Last Post: study tips
  THREE DIMENSIONAL PASSWORD FOR MORE SECURE AUTHENTICATION A MAIN PROJECT REPORT study tips 0 429 29-08-2013, 02:15 PM
Last Post: study tips