Do anyone could tell me how to display the date from the sql to a jtable?

Member Avatar for ztini
import java.text.MessageFormat;
import java.util.Date;

import javax.swing.JTable;

public class JTableDateExample {
	
	public static String getDateFromDB() { 
		Date date = new Date(); // your SQL query goes here instead
		return MessageFormat.format("{0, yyyyMMdd}", date); // format using SimpleDateFormat
	}
	
	public static void main(String[] args) { 
			
		String[] columnNames = new String[] { "Date as yyyyMMdd" };
		String[][] data = new String[][] { 
				{ getDateFromDB() }
		};
		
		JTable jtable = new JTable(data, columnNames);

	}
}

See:
Oracle's JTable tutorial
JTable Javadoc
SimpleDateFormat Javadoc

This is my code in adding the date

pst.setDate(11, new java.sql.Date(System.currentTimeMillis()));

and this is my code in the JTable to display the date

updatedateborrowed.setText(jTable1.getModel().getValueAt(row, 10).toString());

Is there somethings wrong with my code, retrieving the date and display to jtable?

Member Avatar for ztini

This is my code in adding the date

pst.setDate(11, new java.sql.Date(System.currentTimeMillis()));

and this is my code in the JTable to display the date

updatedateborrowed.setText(jTable1.getModel().getValueAt(row, 10).toString());

Is there somethings wrong with my code, retrieving the date and display to jtable?

Post more of your code. What errors are you seeing? Not the correct format or what?

JTable knows Date instance, in the linked tutorial is list of types of data, for these types of data aren't required set whatever or modifying ...

this is my whole code:

link: http://pastebin.com/aUBFjSuX

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author RC
 */
import java.awt.BorderLayout;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.swing.JOptionPane;
import net.proteanit.sql.DbUtils;
import java.sql.*;
import net.sf.jasperreports.engine.design.*;
import net.sf.jasperreports.view.JasperViewer;
import net.sf.jasperreports.engine.*;
import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
import net.sf.jasperreports.engine.xml.JRXmlLoader;



public class FormJFrame extends javax.swing.JFrame {

   
    Connection conn = null;
    ResultSet rs = null;
    PreparedStatement pst = null;
    
    private void FillCombo(){
        String sql = "SELECT * FROM equipment";
        try{
            pst = conn.prepareStatement(sql);
            rs = pst.executeQuery();
            while (rs.next()){
                
                String nme = rs.getString("Equipment_Name");
                comboequip.addItem(nme);
            }
        }
        catch(Exception e){
            JOptionPane.showMessageDialog(null, e);
        }
    }
    
    
   
    
    private void UpdateJTable(){
        String sql = "SELECT Student_ID,Student_FN, Student_LN, Student_MI, Address, Course, Year, Contact_No, Equipment_Name, Quantity FROM student";
        try{
            pst = conn.prepareStatement(sql);
            rs = pst.executeQuery(sql);
            jTable1.setModel(DbUtils.resultSetToTableModel(rs));
        }
        catch (Exception e){
            JOptionPane.showMessageDialog(null, e);
        }
    }
    
   
    
    //PreparedStatement pst2 = null;

    /**
     * Creates new form FormJFrame
     */
    public FormJFrame() {
        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.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {

        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        txtlast = new javax.swing.JTextField();
        txtfirst = new javax.swing.JTextField();
        txtinitial = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        txtaddress = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        txtid = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        itemcourse = new javax.swing.JComboBox();
        itemyear = new javax.swing.JComboBox();
        jLabel8 = new javax.swing.JLabel();
        txtcontact = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        comboequip = new javax.swing.JComboBox();
        jLabel10 = new javax.swing.JLabel();
        itemquantity = new javax.swing.JComboBox();
        cmdadd = new javax.swing.JButton();
        jLabel22 = new javax.swing.JLabel();
        jDateChooser1 = new com.toedter.calendar.JDateChooser();
        jPanel4 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jLabel11 = new javax.swing.JLabel();
        updateid = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        updatelast = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        updatefirst = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        updateinitial = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        updateaddress = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        updatecourse = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        updateyear = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        updatecontact = new javax.swing.JTextField();
        jLabel19 = new javax.swing.JLabel();
        updateequip = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        updatequantity = new javax.swing.JTextField();
        cmdupdate = new javax.swing.JButton();
        cmddelete = new javax.swing.JButton();
        jLabel21 = new javax.swing.JLabel();
        txtsearch = new javax.swing.JTextField();
        cmdPrintAll = new javax.swing.JButton();
        jLabel23 = new javax.swing.JLabel();
        updateborrowed = new javax.swing.JTextField();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTable2 = new javax.swing.JTable();
        jPanel2 = new javax.swing.JPanel();
        jLabel24 = new javax.swing.JLabel();
        jLabel27 = new javax.swing.JLabel();
        jLabel26 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        aboutclick = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });

        jTabbedPane1.setBackground(new java.awt.Color(102, 102, 102));

        jLabel1.setText("Last Name:");

        jLabel2.setText("First Name:");

        jLabel3.setText("Middle Initial:");

        txtlast.setBackground(new java.awt.Color(204, 255, 204));

        txtfirst.setBackground(new java.awt.Color(204, 255, 204));

        txtinitial.setBackground(new java.awt.Color(204, 255, 204));

        jLabel4.setText("Address:");

        txtaddress.setBackground(new java.awt.Color(204, 255, 204));

        jLabel5.setText("Student ID:");

        txtid.setBackground(new java.awt.Color(204, 255, 204));

        jLabel6.setText("Course:");

        jLabel7.setText("Year:");

        itemcourse.setBackground(new java.awt.Color(204, 255, 204));
        itemcourse.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "BSCS", "BSIT", "NMCA", "BSECE", "BSCoe", "BS Biology", "aCon" }));
        itemcourse.setSelectedItem(null);

        itemyear.setBackground(new java.awt.Color(204, 255, 204));
        itemyear.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "I", "II", "III", "IV", "V" }));
        itemyear.setSelectedItem(null);

        jLabel8.setText("Contact No:");

        txtcontact.setBackground(new java.awt.Color(204, 255, 204));

        jLabel9.setText("Equipment to Borrow:");

        comboequip.setBackground(new java.awt.Color(204, 255, 204));

        jLabel10.setText("Quantity:");

        itemquantity.setBackground(new java.awt.Color(204, 255, 204));
        itemquantity.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" }));

        cmdadd.setIcon(new javax.swing.ImageIcon("C:\\Users\\RC\\Documents\\NetBeansProjects\\AdzuSGov\\pictures\\Folder-Add-icon.png")); // NOI18N
        cmdadd.setText("Add");
        cmdadd.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                cmdaddMouseClicked(evt);
            }
        });

        jLabel22.setText("Date Borrowed:");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel22)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jDateChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel5)
                        .addGap(18, 18, 18)
                        .addComponent(txtid, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel1)
                            .addComponent(jLabel4)
                            .addComponent(jLabel6)
                            .addComponent(jLabel8))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtaddress, javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtcontact, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel10)
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addComponent(txtlast, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(jLabel2)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(txtfirst, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGap(18, 18, 18)
                                .addComponent(jLabel3)
                                .addGap(18, 18, 18)
                                .addComponent(txtinitial, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(cmdadd)
                                .addGroup(jPanel1Layout.createSequentialGroup()
                                    .addComponent(itemcourse, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(32, 32, 32)
                                    .addComponent(jLabel7)
                                    .addGap(18, 18, 18)
                                    .addComponent(itemyear, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel9)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(comboequip, javax.swing.GroupLayout.PREFERRED_SIZE, 186, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(405, 405, 405)
                        .addComponent(itemquantity, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(379, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(txtid, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(txtlast, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2)
                    .addComponent(txtfirst, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3)
                    .addComponent(txtinitial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(txtaddress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(jLabel7)
                    .addComponent(itemcourse, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(itemyear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(txtcontact, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(30, 30, 30)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(comboequip, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10)
                    .addComponent(itemquantity, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(33, 33, 33)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel22)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jDateChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(79, 79, 79)
                        .addComponent(cmdadd)))
                .addGap(104, 108, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Add Information", jPanel1);

        jTable1.setBackground(new java.awt.Color(204, 255, 204));
        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Student ID", "Last Name", "First Name", "Middle Initial", "Address", "Course", "Year", "Contact No", "Borrowed Equip", "Quantity", "DateBorrowed"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Long.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        jTable1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTable1MouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(jTable1);

        jLabel11.setText("Student ID:");

        updateid.setBackground(new java.awt.Color(204, 255, 204));

        jLabel12.setText("Last Name:");

        updatelast.setBackground(new java.awt.Color(204, 255, 204));

        jLabel13.setText("First Name:");

        updatefirst.setBackground(new java.awt.Color(204, 255, 204));

        jLabel14.setText("Middle Initial:");

        updateinitial.setBackground(new java.awt.Color(204, 255, 204));

        jLabel15.setText("Address:");

        updateaddress.setBackground(new java.awt.Color(204, 255, 204));

        jLabel16.setText("Course:");

        updatecourse.setBackground(new java.awt.Color(204, 255, 204));

        jLabel17.setText("Year:");

        updateyear.setBackground(new java.awt.Color(204, 255, 204));

        jLabel18.setText("Contact No.");

        updatecontact.setBackground(new java.awt.Color(204, 255, 204));

        jLabel19.setText("Borrowed Equipment:");

        updateequip.setBackground(new java.awt.Color(204, 255, 204));

        jLabel20.setText("Quantity:");

        updatequantity.setBackground(new java.awt.Color(204, 255, 204));

        cmdupdate.setIcon(new javax.swing.ImageIcon("C:\\Users\\RC\\Documents\\NetBeansProjects\\AdzuSGov\\pictures\\Actions-document-edit-icon.png")); // NOI18N
        cmdupdate.setText("Update");
        cmdupdate.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                cmdupdateMouseClicked(evt);
            }
        });

        cmddelete.setIcon(new javax.swing.ImageIcon("C:\\Users\\RC\\Documents\\NetBeansProjects\\AdzuSGov\\pictures\\delete-icon.png")); // NOI18N
        cmddelete.setText("Delete");
        cmddelete.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                cmddeleteMouseClicked(evt);
            }
        });

        jLabel21.setText("Search Keyword:");

        txtsearch.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                txtsearchKeyReleased(evt);
            }
        });

        cmdPrintAll.setIcon(new javax.swing.ImageIcon("C:\\Users\\RC\\Documents\\NetBeansProjects\\AdzuSGov\\pictures\\Device-Printer-icon.png")); // NOI18N
        cmdPrintAll.setText("Print All");
        cmdPrintAll.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                cmdPrintAllMouseClicked(evt);
            }
        });

        jLabel23.setText("Date Borrowed: ");

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGap(21, 21, 21)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addComponent(jLabel18)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(updatecontact, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel4Layout.createSequentialGroup()
                                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel12)
                                            .addComponent(jLabel15)
                                            .addComponent(jLabel16))
                                        .addGap(18, 18, 18)
                                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                            .addGroup(jPanel4Layout.createSequentialGroup()
                                                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addComponent(updateaddress, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addGroup(jPanel4Layout.createSequentialGroup()
                                                        .addComponent(updatecourse, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addGap(30, 30, 30)
                                                        .addComponent(jLabel17)
                                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                        .addComponent(updateyear, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                                                .addComponent(updatelast, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGap(18, 18, 18)
                                                .addComponent(jLabel13)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                .addComponent(updatefirst, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 22, Short.MAX_VALUE)
                                                .addComponent(jLabel14)
                                                .addGap(12, 12, 12))))
                                    .addGroup(jPanel4Layout.createSequentialGroup()
                                        .addComponent(jLabel11)
                                        .addGap(18, 18, 18)
                                        .addComponent(updateid, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                                .addComponent(updateinitial, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel4Layout.createSequentialGroup()
                                        .addComponent(jLabel19)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(updateequip, javax.swing.GroupLayout.PREFERRED_SIZE, 186, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(55, 55, 55)
                                        .addComponent(jLabel20)
                                        .addGap(10, 10, 10)
                                        .addComponent(updatequantity, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(jPanel4Layout.createSequentialGroup()
                                        .addGap(167, 167, 167)
                                        .addComponent(cmdupdate)
                                        .addGap(62, 62, 62)
                                        .addComponent(cmddelete)))
                                .addGap(38, 38, 38)
                                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(cmdPrintAll)
                                    .addGroup(jPanel4Layout.createSequentialGroup()
                                        .addComponent(jLabel23)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(updateborrowed, javax.swing.GroupLayout.PREFERRED_SIZE, 149, javax.swing.GroupLayout.PREFERRED_SIZE))))))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGap(209, 209, 209)
                        .addComponent(jLabel21)
                        .addGap(18, 18, 18)
                        .addComponent(txtsearch, javax.swing.GroupLayout.PREFERRED_SIZE, 191, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                .addGap(0, 39, Short.MAX_VALUE)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 873, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(74, 74, 74))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11)
                    .addComponent(updateid, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel12)
                    .addComponent(updatelast, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel13)
                    .addComponent(updatefirst, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel14)
                    .addComponent(updateinitial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel15)
                    .addComponent(updateaddress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel16)
                    .addComponent(updatecourse, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel17)
                    .addComponent(updateyear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18)
                    .addComponent(updatecontact, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel19)
                    .addComponent(updateequip, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel20)
                    .addComponent(updatequantity, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel23)
                    .addComponent(updateborrowed, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(27, 27, 27)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cmdupdate)
                    .addComponent(cmddelete)
                    .addComponent(cmdPrintAll))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtsearch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel21))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(23, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Update Information", jPanel4);

        jTable2.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null}
            },
            new String [] {
                "Student ID", "Last Name", "First Name", "Middle Initial", "Address", "Course", "Year", "Contact No.", "Borrowed Equip.", "Quantity"
            }
        ));
        jScrollPane2.setViewportView(jTable2);

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(38, 38, 38)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 877, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(71, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(52, 52, 52)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 266, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(209, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Overdue", jPanel3);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );

        jLabel24.setIcon(new javax.swing.ImageIcon(getClass().getResource("/adzu.png"))); // NOI18N

        jLabel27.setIcon(new javax.swing.ImageIcon(getClass().getResource("/seal(1).png"))); // NOI18N

        jLabel26.setIcon(new javax.swing.ImageIcon(getClass().getResource("/glossy_stripe.png"))); // NOI18N
        jLabel26.setVerticalAlignment(javax.swing.SwingConstants.TOP);

        jMenu1.setText("File");

        jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem2.setText("Exit");
        jMenuItem2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenuItem2MouseClicked(evt);
            }
        });
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem2);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Help");

        aboutclick.setText("About");
        aboutclick.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                aboutclickMouseClicked(evt);
            }
        });
        aboutclick.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                aboutclickActionPerformed(evt);
            }
        });
        jMenu2.add(aboutclick);

        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 991, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jLabel26)
                        .addGap(28, 28, 28)
                        .addComponent(jLabel24, javax.swing.GroupLayout.PREFERRED_SIZE, 484, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel27)
                        .addGap(241, 241, 241))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(357, 357, 357))
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel27)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(38, 38, 38)
                        .addComponent(jLabel24, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel26))
                .addGap(18, 18, 18)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 555, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 11, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>                        

    private void formWindowOpened(java.awt.event.WindowEvent evt) {                                  
        // TODO add your handling code here:
        conn = mysqlconnect.ConnectDB();
        UpdateJTable();
        FillCombo();
        setTitle("Student Government Borrowing System");
        setExtendedState(MAXIMIZED_BOTH);
        //setUndecorated(true);
        setLocationRelativeTo(null);
       
        
        
    }                                 

    private void txtsearchKeyReleased(java.awt.event.KeyEvent evt) {                                      
        // TODO add your handling code here:
        String sql = "SELECT * FROM student WHERE Student_ID = ? OR Student_LN LIKE ? OR Student_FN LIKE ? OR Student_MI LIKE ? OR Address LIKE ? OR Course LIKE ? OR Year LIKE ? OR Contact_No LIKE ? OR Equipment_Name LIKE ? OR Quantity LIKE ?";
        try {
            pst = conn.prepareStatement(sql);
            pst.setString(1, txtsearch.getText() + "%");
            pst.setString(2, txtsearch.getText() + "%");
            pst.setString(3, txtsearch.getText() + "%");
            pst.setString(4, txtsearch.getText() + "%");
            pst.setString(5, txtsearch.getText() + "%");
            pst.setString(6, txtsearch.getText() + "%");
            pst.setString(7, txtsearch.getText() + "%");
            pst.setString(8, txtsearch.getText() + "%");
            pst.setString(9, txtsearch.getText() + "%");
            pst.setString(10, txtsearch.getText() + "%");
            
            rs = pst.executeQuery();
            jTable1.setModel(DbUtils.resultSetToTableModel(rs));
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, e);
        }
    }                                     

    private void cmddeleteMouseClicked(java.awt.event.MouseEvent evt) {                                       
        // TODO add your handling code here:
        String sql = "DELETE FROM student WHERE Student_ID = ?";
        try {
            pst = conn.prepareStatement(sql);
            pst.setString(1, updateid.getText());
            pst.execute();
            JOptionPane.showMessageDialog(null, "Deletion Succesful");
            UpdateJTable();

        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, e);
        }
    }                                      

    private void cmdupdateMouseClicked(java.awt.event.MouseEvent evt) {                                       
        // TODO add your handling code here:
        String sql = "UPDATE student SET Student_LN = ?, Student_FN = ?, Student_MI = ?, Address = ?, Course = ?, Year = ?, Contact_No = ?, Equipment_Name = ?, Quantity = ? WHERE Student_ID = ?";
        try {
            pst = conn.prepareStatement(sql);
            pst.setString(1, updatelast.getText());
            pst.setString(2, updatefirst.getText());
            pst.setString(3, updateinitial.getText());
            pst.setString(4, updateaddress.getText());
            pst.setString(5, updatecourse.getText());
            pst.setString(6, updateyear.getText());
            pst.setString(7, updatecontact.getText());
            pst.setString(8, updateequip.getText());
            pst.setString(9, updatequantity.getText());
            pst.setString(10, updateid.getText());
            pst.executeUpdate();
            JOptionPane.showMessageDialog(null, "Update Successful!");
            UpdateJTable();

        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, e);
        }
    }                                      

    private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {                                     
        // TODO add your handling code here:
        int row = jTable1.getSelectedRow();
        updateid.setText(jTable1.getModel().getValueAt(row, 0).toString());
        updatelast.setText(jTable1.getModel().getValueAt(row, 1).toString());
        updatefirst.setText(jTable1.getModel().getValueAt(row, 2).toString());
        updateinitial.setText(jTable1.getModel().getValueAt(row, 3).toString());
        updateaddress.setText(jTable1.getModel().getValueAt(row, 4).toString());
        updatecourse.setText(jTable1.getModel().getValueAt(row, 5).toString());
        updateyear.setText(jTable1.getModel().getValueAt(row, 6).toString());
        updatecontact.setText(jTable1.getModel().getValueAt(row, 7).toString());
        updateequip.setText(jTable1.getModel().getValueAt(row, 8).toString());
        updatequantity.setText(jTable1.getModel().getValueAt(row, 9).toString());
        //updateborrowed.setText(jTable1.getModel().getValueAt(row, 10).toString());
        
        
        
        
        
    }                                    

    private void cmdaddMouseClicked(java.awt.event.MouseEvent evt) {                                    
        // TODO add your handling code here:
        String sql = "INSERT INTO student (Student_ID, Student_LN, Student_FN, Student_MI, Address, Course, Year, Contact_No, Equipment_Name, Quantity, Date_Borrowed) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
            
         
        try {
          
            pst = conn.prepareStatement(sql);
            pst.setString(1, txtid.getText());
            pst.setString(2, txtlast.getText());
            pst.setString(3, txtfirst.getText());
            pst.setString(4, txtinitial.getText());
            pst.setString(5, txtaddress.getText());
            pst.setObject(6, itemcourse.getSelectedItem());
            pst.setObject(7, itemyear.getSelectedItem());
            pst.setString(8, txtcontact.getText());
            pst.setObject(9, comboequip.getSelectedItem());
            pst.setObject(10, itemquantity.getSelectedItem());
            pst.setDate(11, new java.sql.Date(System.currentTimeMillis()));
            if(txtid.getText().trim().equals("")){
                JOptionPane.showMessageDialog(null, "Please specify Student ID");
            }
            else if (txtlast.getText().trim().equals("")){
                JOptionPane.showMessageDialog(null, "Please specify Last Name");
            }
            else if (txtfirst.getText().trim().equals("")){
                JOptionPane.showMessageDialog(null, "Please specify First Name");
            }
            else if (txtinitial.getText().trim().equals("")){
                JOptionPane.showMessageDialog(null, "Please specify Middle Inital");
            }
            else if (txtaddress.getText().trim().equals("")){
                JOptionPane.showMessageDialog(null, "Please specify Address");
            }
            else if (itemcourse.getSelectedItem().equals("")){
                JOptionPane.showMessageDialog(null, "Please specify Course");
            }
            else if (itemyear.getSelectedItem().equals("")){
                JOptionPane.showMessageDialog(null, "Please specify Year");
            }
            else if (txtcontact.getText().trim().equals("")){
                JOptionPane.showMessageDialog(null, "Please specify Contact No.");
            }
            else if (comboequip.getSelectedItem().equals("")){
                JOptionPane.showMessageDialog(null, "Please specify Equipment");
            }
            else if (itemquantity.getSelectedItem().equals("")){
                JOptionPane.showMessageDialog(null, "Please specify Quantity");
            }
            else{  
        
            pst.execute();
            UpdateJTable();
            JOptionPane.showMessageDialog(null, "Information Saved!");
            txtid.setText("");
            txtlast.setText("");
            txtfirst.setText("");
            txtinitial.setText("");
            txtaddress.setText("");
            itemcourse.setSelectedItem("");
            itemyear.setSelectedItem("");
            txtcontact.setText("");
            comboequip.setSelectedItem("");
            itemquantity.setSelectedItem("");
            }
           
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, e);
        }
            
    }                                   

    private void aboutclickMouseClicked(java.awt.event.MouseEvent evt) {                                        
        // TODO add your handling code here:
        aboutJFrame a = new aboutJFrame();
                a.setVisible(true);
                
    }                                       

    private void aboutclickActionPerformed(java.awt.event.ActionEvent evt) {                                           
        // TODO add your handling code here:
        aboutJFrame s = new aboutJFrame();
                s.setVisible(true);
    }                                          

    private void cmdPrintAllMouseClicked(java.awt.event.MouseEvent evt) {                                         
        // TODO add your handling code here:
        try{
        JasperDesign jasperDesign = JRXmlLoader.load("AdzuSGReport.jrxml");
        String sql = "select * from student";
        JRDesignQuery newQuery = new JRDesignQuery();
        newQuery.setText(sql);
        jasperDesign.setQuery(newQuery);
        JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);   
        JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, null, conn);
        JasperViewer.viewReport(jasperPrint);
        
    } catch (Exception e){
        JOptionPane.showMessageDialog(null, e);
    }
    }                                        

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

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

    /**
     * @param args the command line arguments
     */

    
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(FormJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(FormJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(FormJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(FormJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run(){
                new FormJFrame().setVisible(true);
            }
        });
    }
   
    // Variables declaration - do not modify                     
    private javax.swing.JMenuItem aboutclick;
    private javax.swing.JButton cmdPrintAll;
    private javax.swing.JButton cmdadd;
    private javax.swing.JButton cmddelete;
    private javax.swing.JButton cmdupdate;
    private javax.swing.JComboBox comboequip;
    private javax.swing.JComboBox itemcourse;
    private javax.swing.JComboBox itemquantity;
    private javax.swing.JComboBox itemyear;
    private com.toedter.calendar.JDateChooser jDateChooser1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    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 jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTable jTable1;
    private javax.swing.JTable jTable2;
    private javax.swing.JTextField txtaddress;
    private javax.swing.JTextField txtcontact;
    private javax.swing.JTextField txtfirst;
    private javax.swing.JTextField txtid;
    private javax.swing.JTextField txtinitial;
    private javax.swing.JTextField txtlast;
    private javax.swing.JTextField txtsearch;
    private javax.swing.JTextField updateaddress;
    private javax.swing.JTextField updateborrowed;
    private javax.swing.JTextField updatecontact;
    private javax.swing.JTextField updatecourse;
    private javax.swing.JTextField updateequip;
    private javax.swing.JTextField updatefirst;
    private javax.swing.JTextField updateid;
    private javax.swing.JTextField updateinitial;
    private javax.swing.JTextField updatelast;
    private javax.swing.JTextField updatequantity;
    private javax.swing.JTextField updateyear;
    // End of variables declaration                   
}
Member Avatar for ztini

You still haven't qualified exactly the problem you are facing. Is it not formatting correctly? Is it throwing an error?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.