Из предыдущего решения я делаю изменения в code.it отображение ранее добавленных записей, но не может добавлять новые записи
run: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''' at line 1 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) at com.mysql.jdbc.Util.getInstance(Util.java:408) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3933) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3869) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2675) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2465) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1912) at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2133) at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2067) at com.mysql.jdbc.PreparedStatement.executeLargeUpdate(PreparedStatement.java:5175) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2052) at Customer.btndeleteActionPerformed(Customer.java:691) at Customer.access$700(Customer.java:20) at Customer$8.actionPerformed(Customer.java:404) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6533) at javax.swing.JComponent.processMouseEvent(JComponent.java:3324) at java.awt.Component.processEvent(Component.java:6298) at java.awt.Container.processEvent(Container.java:2236) at java.awt.Component.dispatchEventImpl(Component.java:4889) at java.awt.Container.dispatchEventImpl(Container.java:2294) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466) at java.awt.Container.dispatchEventImpl(Container.java:2280) at java.awt.Window.dispatchEventImpl(Window.java:2746) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.awt.EventQueue$4.run(EventQueue.java:731) at java.awt.EventQueue$4.run(EventQueue.java:729) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''' at line 1 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) at com.mysql.jdbc.Util.getInstance(Util.java:408) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3933) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3869) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2675) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2465) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1912) at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2133) at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2067) at com.mysql.jdbc.PreparedStatement.executeLargeUpdate(PreparedStatement.java:5175) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2052) at Customer.btndeleteActionPerformed(Customer.java:691) at Customer.access$700(Customer.java:20) at Customer$8.actionPerformed(Customer.java:404) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6533) at javax.swing.JComponent.processMouseEvent(JComponent.java:3324) at java.awt.Component.processEvent(Component.java:6298) at java.awt.Container.processEvent(Container.java:2236) at java.awt.Component.dispatchEventImpl(Component.java:4889) at java.awt.Container.dispatchEventImpl(Container.java:2294) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466) at java.awt.Container.dispatchEventImpl(Container.java:2280) at java.awt.Window.dispatchEventImpl(Window.java:2746) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.awt.EventQueue$4.run(EventQueue.java:731) at java.awt.EventQueue$4.run(EventQueue.java:729) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''' at line 1 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) at com.mysql.jdbc.Util.getInstance(Util.java:408) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3933) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3869) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2675) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2465) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1912) at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2133) at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2067) at com.mysql.jdbc.PreparedStatement.executeLargeUpdate(PreparedStatement.java:5175) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2052) at Customer.btndeleteActionPerformed(Customer.java:691) at Customer.access$700(Customer.java:20) at Customer$8.actionPerformed(Customer.java:404) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6533) at javax.swing.JComponent.processMouseEvent(JComponent.java:3324) at java.awt.Component.processEvent(Component.java:6298) at java.awt.Container.processEvent(Container.java:2236) at java.awt.Component.dispatchEventImpl(Component.java:4889) at java.awt.Container.dispatchEventImpl(Container.java:2294) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466) at java.awt.Container.dispatchEventImpl(Container.java:2280) at java.awt.Window.dispatchEventImpl(Window.java:2746) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.awt.EventQueue$4.run(EventQueue.java:731) at java.awt.EventQueue$4.run(EventQueue.java:729) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'id=22'' at line 1 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) at com.mysql.jdbc.Util.getInstance(Util.java:408) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3933) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3869) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2675) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2465) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1912) at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2133) at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2067) at com.mysql.jdbc.PreparedStatement.executeLargeUpdate(PreparedStatement.java:5175) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2052) at Customer.btnSaveActionPerformed(Customer.java:620) at Customer.access$500(Customer.java:20) at Customer$6.actionPerformed(Customer.java:382) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6533) at javax.swing.JComponent.processMouseEvent(JComponent.java:3324) at java.awt.Component.processEvent(Component.java:6298) at java.awt.Container.processEvent(Container.java:2236) at java.awt.Component.dispatchEventImpl(Component.java:4889) at java.awt.Container.dispatchEventImpl(Container.java:2294) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466) at java.awt.Container.dispatchEventImpl(Container.java:2280) at java.awt.Window.dispatchEventImpl(Window.java:2746) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.awt.EventQueue$4.run(EventQueue.java:731) at java.awt.EventQueue$4.run(EventQueue.java:729) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) java.lang.NumberFormatException: For input string: "sww" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Long.parseLong(Long.java:589) at java.lang.Long.parseLong(Long.java:631) at Customer.btnSaveActionPerformed(Customer.java:603) at Customer.access$500(Customer.java:20) at Customer$6.actionPerformed(Customer.java:382) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6533) at javax.swing.JComponent.processMouseEvent(JComponent.java:3324) at java.awt.Component.processEvent(Component.java:6298) at java.awt.Container.processEvent(Container.java:2236) at java.awt.Component.dispatchEventImpl(Component.java:4889) at java.awt.Container.dispatchEventImpl(Container.java:2294) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466) at java.awt.Container.dispatchEventImpl(Container.java:2280) at java.awt.Window.dispatchEventImpl(Window.java:2746) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.awt.EventQueue$4.run(EventQueue.java:731) at java.awt.EventQueue$4.run(EventQueue.java:729) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) BUILD SUCCESSFUL (total time: 1 minute 41 seconds)
Что я уже пробовал:
import java.awt.print.PrinterException; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement; import java.text.MessageFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JTable; import javax.swing.RowFilter; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableRowSorter; public class Customer extends javax.swing.JFrame { Connection conn=null; PreparedStatement pst= null; ResultSet rs=null; public Customer() { initComponents(); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); showTable(); } int pos = 0; //----------------------------------------------------------------------------------------filtering tbl_registered for search private void filter(String sql){ DefaultTableModel model=(DefaultTableModel)table.getModel(); TableRowSorter<DefaultTableModel>tr=new TableRowSorter <DefaultTableModel>(model); table.setRowSorter(tr); tr.setRowFilter(RowFilter.regexFilter(sql)); } //_____________________________________________________________________________________________Populating Array List Registered Records public ArrayList<ClassCustomer> dataList() { ArrayList<ClassCustomer> dataList = new ArrayList<>(); conn=mySqlConnection.ConnectDB(); String sql="select * from customer"; try{ Statement st = conn.createStatement(); rs=st.executeQuery(sql); ClassCustomer Data; while(rs.next()){ Data=new ClassCustomer(rs.getInt("id"),rs.getString("cus_name"),rs.getString("cus_surname"),rs.getString("address"),rs.getLong("cus_nic"),rs.getString("cus_date"),rs.getLong("phone"),rs.getString("cus_country"),rs.getString("cus_city"),rs.getString("function_type"),rs.getString("album_type"),rs.getString("album_theme"),rs.getFloat("cost"),rs.getFloat("taxes")); dataList.add(Data); } }catch(Exception ex) { ex.printStackTrace(); } return dataList; } /* public ArrayList<ClassCustomer> dataList() { ArrayList<ClassCustomer> dataList = new ArrayList<ClassCustomer>(); conn=mySqlConnection.ConnectDB(); String sql="select * from customer"; try{ Statement st = conn.createStatement(); rs=st.executeQuery(sql); ClassCustomer Data; while(rs.next()){ //Data = new ClassCustomer(rs.getInt("id"),rs.getString("name"),rs.getString("surname"),rs.getString("address"),rs.getLong("nic"),rs.getString("date"),rs.getLong("phone"),rs.getString("country"),rs.getString("city"),rs.getString("funtype"),rs.getString("albumtype"),rs.getString("albumtheme"),rs.getFloat("cost"),rs.getFloat("taxes")); Data = new ClassCustomer(rs.getInt("id"),rs.getString("name"),rs.getString("surname"),rs.getString("address"),rs.getLong("nic"),rs.getString("date"),rs.getLong("phone"),rs.getString("country"),rs.getString("city"),rs.getString("funtype"),rs.getString("albumtype"),rs.getString("albumtheme"),rs.getFloat("cost"),rs.getFloat("taxes")); dataList.add(Data); } } catch(Exception ex){ ex.printStackTrace(); } return dataList; }*/ //_________________________________________________________________________________________Display data in table public void showTable(){ ArrayList<ClassCustomer> list = dataList(); DefaultTableModel model = (DefaultTableModel)table.getModel(); while(table.getRowCount()>0) { ((DefaultTableModel)table.getModel()).removeRow(0); } Object[]row = new Object[14]; for(int i = 0; i <list.size(); i++) { row[0]=list.get(i).getid(); row[1]=list.get(i).getname(); row[2]=list.get(i).getsurname(); row[3]=list.get(i).getaddress(); row[4]=list.get(i).getnic(); row[5]=list.get(i).getdate(); row[6]=list.get(i).getphone(); row[7]=list.get(i).getcountry(); row[8]=list.get(i).getcity(); row[9]=list.get(i).getfuntype(); row[10]=list.get(i).getalbumtype(); row[11]=list.get(i).getalbumtheme(); row[12]=list.get(i).getcost(); row[13]=list.get(i).gettaxes(); model.addRow(row); } } //_____________________________________________________________________________________________Show Items public void showItems(int index){ lblid.setText(Integer.toString(dataList().get(index).getid())); txtname.setText(dataList().get(index).getname()); //txtname.setText(dataList().get(index).getname()); txtsurname.setText(dataList().get(index).getsurname()); txtaddress.setText(dataList().get(index).getaddress()); txtnic.setText(Long.toString(dataList().get(index).getnic())); try{ Date addDate= null; addDate = new SimpleDateFormat("yyyy-MM-dd").parse((String)dataList().get(index).getdate()); this.Date.setDate(addDate); } catch(ParseException e){ JOptionPane.showMessageDialog(null,"Date and Time Error"); } txtphone.setText(Long.toString(dataList().get(index).getphone())); combocountry.setSelectedItem(dataList().get(index).getcountry()); combocity.setSelectedItem(dataList().get(index).getcity()); comboFtype.setSelectedItem(dataList().get(index).getfuntype()); comboAtype.setSelectedItem(dataList().get(index).getalbumtype()); comboAtheme.setSelectedItem(dataList().get(index).getalbumtheme()); txtcost.setText(Float.toString(dataList().get(index).getcost())); txttax.setText(Float.toString(dataList().get(index).gettaxes())); } // @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { searchBox = new javax.swing.JTextField(); btn_print = new javax.swing.JButton(); btn_refresh = new javax.swing.JButton(); btn_forward = new javax.swing.JButton(); btn_backward = new javax.swing.JButton(); jPanel1 = new javax.swing.JPanel(); top = new javax.swing.JPanel(); jLabel12 = new javax.swing.JLabel(); lblid = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); table = new javax.swing.JTable(); jLabel3 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); txtname = new javax.swing.JTextField(); jLabel4 = new javax.swing.JLabel(); Date = new com.toedter.calendar.JDateChooser(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); lblcity = new javax.swing.JLabel(); txtsurname = new javax.swing.JTextField(); txtaddress = new javax.swing.JTextField(); txtnic = new javax.swing.JTextField(); txtphone = new javax.swing.JTextField(); combocity = new javax.swing.JComboBox<String>(); jLabel15 = new javax.swing.JLabel(); jLabel16 = new javax.swing.JLabel(); comboFtype = new javax.swing.JComboBox<String>(); txttax = new javax.swing.JTextField(); txtsearch = new javax.swing.JTextField(); btn_refresh1 = new javax.swing.JButton(); btn_forward1 = new javax.swing.JButton(); btn_backward1 = new javax.swing.JButton(); btnSave = new javax.swing.JButton(); btnUpdate = new javax.swing.JButton(); btndelete = new javax.swing.JButton(); combocountry = new javax.swing.JComboBox<String>(); jLabel19 = new javax.swing.JLabel(); txtcost = new javax.swing.JTextField(); comboAtype = new javax.swing.JComboBox(); comboAtheme = new javax.swing.JComboBox(); searchBox.setBackground(new java.awt.Color(33, 55, 116)); searchBox.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N searchBox.setForeground(new java.awt.Color(153, 255, 255)); btn_print.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/printer (1).png"))); // NOI18N btn_print.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btn_refresh.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/icons8-refresh-35.png"))); // NOI18N btn_refresh.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btn_forward.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/icons8-circled-right-35.png"))); // NOI18N btn_forward.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btn_backward.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/icons8-go-back-35.png"))); // NOI18N btn_backward.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jPanel1.setBackground(new java.awt.Color(0, 0, 51)); top.setBackground(new java.awt.Color(255, 0, 0)); jLabel12.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N jLabel12.setForeground(new java.awt.Color(255, 255, 255)); jLabel12.setText("Customer ID:"); lblid.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N lblid.setForeground(new java.awt.Color(255, 255, 255)); lblid.setText("00"); jLabel1.setFont(new java.awt.Font("Serif", 1, 18)); // NOI18N jLabel1.setText("SWIM SNAPS PHOTOGRAPHY"); javax.swing.GroupLayout topLayout = new javax.swing.GroupLayout(top); top.setLayout(topLayout); topLayout.setHorizontalGroup( topLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(topLayout.createSequentialGroup() .addGap(266, 266, 266) .addComponent(jLabel1) .addGap(179, 179, 179) .addComponent(jLabel12) .addGap(18, 18, 18) .addComponent(lblid) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); topLayout.setVerticalGroup( topLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(topLayout.createSequentialGroup() .addContainerGap() .addGroup(topLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel12) .addComponent(lblid) .addComponent(jLabel1)) .addContainerGap()) ); table.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, null, null}, {null, null, null, null, null, null, null, null, null, null, null, null, null, null} }, new String [] { "ID", "Name", "Surname", "address", "nic", "Date", "Phone", "Country", "City", "Function Type", "Album Type", "Album Theme", "Cost", "Taxes" } )); table.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { tableMouseClicked(evt); } }); jScrollPane1.setViewportView(table); jLabel3.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N jLabel3.setForeground(new java.awt.Color(255, 255, 255)); jLabel3.setText("Name:"); jLabel7.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N jLabel7.setForeground(new java.awt.Color(255, 255, 255)); jLabel7.setText("Date:"); jLabel6.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N jLabel6.setForeground(new java.awt.Color(255, 255, 255)); jLabel6.setText("Function Type:"); jLabel5.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N jLabel5.setForeground(new java.awt.Color(255, 255, 255)); jLabel5.setText("Album Type:"); txtname.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N jLabel4.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N jLabel4.setForeground(new java.awt.Color(255, 255, 255)); jLabel4.setText("Phone:"); jLabel8.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N jLabel8.setForeground(new java.awt.Color(255, 255, 255)); jLabel8.setText("Surname:"); jLabel9.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N jLabel9.setForeground(new java.awt.Color(255, 255, 255)); jLabel9.setText("Address:"); jLabel10.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N jLabel10.setForeground(new java.awt.Color(255, 255, 255)); jLabel10.setText("NIC/Passport:"); jLabel11.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N jLabel11.setForeground(new java.awt.Color(255, 255, 255)); jLabel11.setText("Country:"); lblcity.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N lblcity.setForeground(new java.awt.Color(255, 255, 255)); lblcity.setText("City:"); txtsurname.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N txtaddress.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N txtnic.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N txtphone.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N combocity.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "None", "Mumbai", "Delhi", "Bangalore", "Hyderabad", "Ahmedabad", "Badalapur", "Chennai", "Kolkata", "Surat", "Pune", "Jaipur", "Lucknow", "Bhopal", "Patna", "Srinagar", "Raipur", "Chandigarh", "Bhubaneswar", "Shimala", "Amaravati", " ", " ", " " })); jLabel15.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N jLabel15.setForeground(new java.awt.Color(255, 255, 255)); jLabel15.setText("Album Theme:"); jLabel16.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N jLabel16.setForeground(new java.awt.Color(255, 255, 255)); jLabel16.setText("Taxes:"); comboFtype.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "None", "Wedding +Reception", "Engagement", "Birthday", "Baby/Children" })); txttax.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N txtsearch.setBackground(new java.awt.Color(0, 0, 51)); txtsearch.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N txtsearch.setForeground(new java.awt.Color(153, 255, 255)); txtsearch.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { txtsearchKeyReleased(evt); } }); btn_refresh1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/icons8-refresh-35.png"))); // NOI18N btn_refresh1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btn_refresh1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_refresh1ActionPerformed(evt); } }); btn_forward1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/icons8-circled-right-35.png"))); // NOI18N btn_forward1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btn_forward1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_forward1ActionPerformed(evt); } }); btn_backward1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/icons8-go-back-35.png"))); // NOI18N btn_backward1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btn_backward1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_backward1ActionPerformed(evt); } }); btnSave.setBackground(new java.awt.Color(0, 0, 51)); btnSave.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N btnSave.setForeground(new java.awt.Color(255, 255, 255)); btnSave.setText("Save"); btnSave.setHorizontalAlignment(javax.swing.SwingConstants.LEADING); btnSave.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSaveActionPerformed(evt); } }); btnUpdate.setBackground(new java.awt.Color(0, 0, 51)); btnUpdate.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N btnUpdate.setForeground(new java.awt.Color(255, 255, 255)); btnUpdate.setText("Update"); btnUpdate.setHorizontalAlignment(javax.swing.SwingConstants.LEADING); btnUpdate.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnUpdateActionPerformed(evt); } }); btndelete.setBackground(new java.awt.Color(0, 0, 51)); btndelete.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N btndelete.setForeground(new java.awt.Color(255, 255, 255)); btndelete.setText("Delete "); btndelete.setHorizontalAlignment(javax.swing.SwingConstants.LEADING); btndelete.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btndeleteActionPerformed(evt); } }); combocountry.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "None", "Afghanistan ", "Albania ", "Algeria ", "Andorra ", "Angola ", "Antarctica ", "Antigua and Barbuda ", "Argentina ", "Armenia ", "Aruba ", "Australia ", "Austria ", "Azerbaijan ", "Bahamas ", "Bahrain ", "Bangladesh ", "Barbados ", "Belarus ", "Belgium ", "Belize ", "Benin ", "Bhutan ", "Bolivia ", "Bosnia and Herzegovina ", "Botswana ", "Brazil ", "Brunei ", "Bulgaria ", "Burkina Faso ", "Burundi ", "Cambodia ", "Cameroon ", "Canada ", "Canary Islands ", "Cape Verde Islands ", "Cayman islands ", "Central African Republic ", "Chad ", "Chile ", "China ", "Colombia ", "Comoros ", "Congo ", "Cook Islands ", "Costa Rica ", "Croatia ", "Cuba ", "Cyprus ", "Czech Republic ", "Democratic Republic of the Congo (Zaire) ", "Denmark ", "Djibouti ", "Dominica ", "Dominican Republic ", "East Timor ", "Ecuador ", "Egypt ", "El Salvador ", "Equatorial Guinea ", "Eritrea ", "Estonia ", "Ethiopia ", "Federated States of Micronesia ", "Fiji ", "Finland ", "France ", "French Guyana ", "French Polynesia ", "Gabon ", "Gambia ", "Georgia ", "Germany ", "Ghana ", "Greece ", "Greenland ", "Grenada ", "Guatemala ", "Guinea ", "Guinea Bissau ", "Guyana ", "Haiti ", "Honduras ", "Hong Kong ", "Hungary ", "Iceland ", "India ", "Indonesia ", "Iran ", "Iraq ", "Israel ", "Italy ", "Ivory Coast/Côte d’Ivoire ", "Jamaica ", "Japan ", "Jordan ", "Kazakhstan ", "Kenya ", "Kiribati ", "Kosovo ", "Kuwait ", "Kyrgyzstan ", "Laos ", "Latvia ", "Lebanon ", "Lesotho ", "Liberia ", "Libya ", "Liechtenstein ", "Lithuania ", "Luxembourg ", "Macedonia ", "Madagascar ", "Malawi ", "Malaysia ", "Maldives ", "Mali ", "Malta ", "Marshall Islands ", "Martinique ", "Mauritania ", "Mauritius ", "Mexico ", "Moldova ", "Monaco ", "Mongolia ", "Montenegro ", "Morocco ", "Mozambique ", "Myanmar (Burma) ", "Namibia ", "Nauru ", "Nepal ", "New Caledonia ", "New Zealand ", "Nicaragua ", "Niger ", "Nigeria ", "North Korea ", "Norway ", "Oman ", "Pakistan", "Palau", "Palestine", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Pitcairn Islands", "Poland", "Portugal ", "Puerto Rico ", "Qatar ", "Republic of Ireland ", "Republic of San Marino ", "Romania ", "Russia ", "Rwanda ", "Samoa ", "Sao Tome ", "Saudi Arabia ", "Scotland ", "Senegal ", "Serbia ", "Seychelles ", "Sierra Leone ", "Singapore ", "Slovakia ", "Slovenia ", "Solomon Islands ", "Somalia ", "South Africa ", "South Korea ", "Spain ", "Sri Lanka ", "St. Kitts and Nevis ", "St. Lucia ", "St. Vincent and The Grenadines ", "Sudan ", "Suriname ", "Swaziland ", "Sweden ", "Switzerland ", "Syria ", "Taiwan ", "Tajikistan ", "Tanzania ", "Thailand ", "The Netherlands ", "The Vatican ", "Togo ", "Tonga ", "Trinidad and Tobago ", "Tunisia ", "Turkey ", "Turkmenistan ", "Tuvalu ", "Uganda ", "Ukraine ", "United Arab Emirates ", "United Kingdom ", "United States ", "Uruguay ", "Uzbekistan ", "Vanuatu ", "Venezuela ", "Vietnam ", "Wales ", "West Bank and Gaza ", "Western Sahara", "Yemen ", "Zambia ", "Zimbabwe ", " " })); jLabel19.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N jLabel19.setForeground(new java.awt.Color(255, 255, 255)); jLabel19.setText("Cost:"); comboAtype.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "None", "Portrait", "Landscape", "2 in 1", "in 1", "Random" })); comboAtheme.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "None", "Classic", "Nature(Green)", "Floral", "Aquatic(Blue/Sea)", "Cartoon", "Random" })); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(top, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jScrollPane1) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(24, 24, 24) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel8) .addComponent(jLabel3) .addComponent(jLabel9)) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(36, 36, 36) .addComponent(txtname, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtaddress, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtsurname, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(2, 2, 2)))) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(20, 20, 20) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(jLabel7) .addGap(63, 63, 63)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(jLabel10) .addGap(18, 18, 18))) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(txtnic, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 158, Short.MAX_VALUE) .addComponent(Date, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) .addGap(40, 40, 40) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblcity) .addComponent(jLabel11) .addComponent(jLabel4)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel19) .addGap(23, 23, 23))) .addGap(42, 42, 42) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(txtphone) .addComponent(combocity, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(combocountry, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtcost)) .addGap(45, 45, 45) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel16) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(txttax, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel6) .addComponent(jLabel5) .addComponent(jLabel15, javax.swing.GroupLayout.Alignment.TRAILING)) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(5, 5, 5) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(comboFtype, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(comboAtype, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addGroup(jPanel1Layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(comboAtheme, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))) .addGap(37, 37, 37)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGap(34, 34, 34) .addComponent(btnSave) .addGap(18, 18, 18) .addComponent(btnUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(btndelete) .addGap(75, 75, 75) .addComponent(btn_backward1, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(27, 27, 27) .addComponent(btn_forward1, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(btn_refresh1, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(txtsearch, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(63, 63, 63)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(top, 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(jLabel3) .addComponent(txtname, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4) .addComponent(txtphone, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel6) .addComponent(comboFtype, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel8) .addComponent(txtsurname, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel11) .addComponent(jLabel5) .addComponent(comboAtype, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(combocountry)) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(77, 77, 77) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel16) .addComponent(txttax, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(17, 17, 17) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtaddress, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel9) .addComponent(lblcity) .addComponent(combocity, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel15) .addComponent(comboAtheme, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(7, 7, 7) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtnic, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel10))) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(30, 30, 30) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel19) .addComponent(txtcost, 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.TRAILING) .addComponent(Date, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel7)))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 113, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(btn_refresh1, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtsearch)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnSave) .addComponent(btnUpdate) .addComponent(btndelete)) .addComponent(btn_backward1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btn_forward1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }// </editor-fold> private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) { try{ conn=mySqlConnection.ConnectDB(); String str="insert into customer(cus_name, cus_surname,address, cus_nic, cus_date, phone, cus_country,cus_city,function_type,album_type,album_theme,cost,taxes)" + "values(?,?,?,?,?,?,?,?,?,?,?,?,?)"; pst = conn.prepareStatement(str); pst.setString(1, txtname.getText()); pst.setString(2, txtsurname.getText()); pst.setString(3, txtaddress.getText()); pst.setLong(4, Long.parseLong(txtnic.getText())); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); String regDate = dateFormat.format(this.Date.getDate()); pst.setString(5, regDate); pst.setLong(6, Long.parseLong(txtphone.getText())); pst.setString(7, combocountry.getSelectedItem().toString()); pst.setString(8, combocity.getSelectedItem().toString()); pst.setString(9,comboFtype.getSelectedItem().toString()); pst.setString(10,comboAtype.getSelectedItem().toString()); pst.setString(11,comboAtheme.getSelectedItem().toString()); pst.setFloat(12, Float.parseFloat(txtcost.getText())); pst.setFloat(13, Float.parseFloat(txttax.getText())); pst.executeUpdate(); JOptionPane.showMessageDialog(null, "Customer "+txtname.getText()+" Has been added"); pst.close(); String del="delete from customer here id="+lblid.getText()+"'"; pst=conn.prepareStatement(del); pst.executeUpdate(); pst.close(); showTable(); txtname.setText(null);txtsurname.setText(null);txtaddress.setText(null);txtnic.setText(null);Date.setDate(null); txtphone.setText(null);combocountry.setSelectedItem(null);combocity.setSelectedItem(null);comboFtype.setSelectedItem(null); comboAtype.setSelectedItem(null);comboAtheme.setSelectedItem(null);txtcost.setText(null);txttax.setText(null); conn.close(); } catch(Exception ex) { ex.printStackTrace(); } } private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt) { try{ conn=mySqlConnection.ConnectDB(); String str="update customer set cus_name=?,cus_surname=?,address=?,cus_nic=?,cus_date=?,phone=?,cus_country=?,cus_city=?,function_type=?,album_type=?,album_theme=?,cost=?,taxes=? where id=?"; pst = conn.prepareStatement(str); pst.setString(1, txtname.getText()); pst.setString(2, txtsurname.getText()); pst.setString(3, txtaddress.getText()); pst.setLong(4, Long.parseLong(txtnic.getText())); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); String regDate = dateFormat.format(this.Date.getDate()); pst.setString(5, regDate); pst.setLong(6, Long.parseLong(txtphone.getText())); pst.setString(7, combocountry.getSelectedItem().toString()); pst.setString(8, combocity.getSelectedItem().toString()); pst.setString(9, comboFtype.getSelectedItem().toString()); pst.setString(10, comboAtype.getSelectedItem().toString()); pst.setString(11, comboAtheme.getSelectedItem().toString()); pst.setFloat(12, Float.parseFloat(txtcost.getText())); pst.setFloat(13, Float.parseFloat(txttax.getText())); pst.setInt(14, Integer.parseInt(lblid.getText())); pst.executeUpdate(); JOptionPane.showMessageDialog(null, "Record Has Been Updated"); pst.close(); pst.close(); showTable(); txtname.setText(null);txtsurname.setText(null);txtaddress.setText(null);txtnic.setText(null);Date.setDate(null); txtphone.setText(null);combocountry.setSelectedItem(null);combocity.setSelectedItem(null); comboFtype.setSelectedItem(null);comboAtype.setSelectedItem(null);comboAtheme.setSelectedItem(null);txtcost.setText(null); txttax.setText(null); conn.close(); } catch(Exception ex) { ex.printStackTrace(); } } private void btndeleteActionPerformed(java.awt.event.ActionEvent evt) { conn=mySqlConnection.ConnectDB(); try{ String del="delete from customer where id"+lblid.getText()+"'"; pst=conn.prepareStatement(del); pst.executeUpdate(); JOptionPane.showMessageDialog(null, "Record Has been Deleted!"); showTable(); pst.close(); conn.close(); } catch(Exception e) { e.printStackTrace(); } } private void txtsearchKeyReleased(java.awt.event.KeyEvent evt) { String txt=txtsearch.getText(); filter(txt); } private void tableMouseClicked(java.awt.event.MouseEvent evt) { int index=table.getSelectedRow(); showItems(index); } private void btn_forward1ActionPerformed(java.awt.event.ActionEvent evt) { pos++; if(pos >=dataList().size()) { pos =dataList().size()-1; } showItems(pos); } private void btn_backward1ActionPerformed(java.awt.event.ActionEvent evt) { pos--; if(pos <0) { pos=0; } showItems(pos); } private void btn_refresh1ActionPerformed(java.awt.event.ActionEvent evt) { showTable(); txtname.setText(null);txtsurname.setText(null);txtaddress.setText(null);txtnic.setText(null);Date.setDate(null); txtphone.setText(null);combocountry.setSelectedItem(null);combocity.setSelectedItem(null); comboFtype.setSelectedItem(null);comboAtype.setSelectedItem(null);comboAtheme.setSelectedItem(null);txtcost.setText(null); txttax.setText(null); } /** * @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(Customer.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Customer.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Customer.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Customer.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 Customer().setVisible(true); } }); } // Variables declaration - do not modify private com.toedter.calendar.JDateChooser Date; private javax.swing.JButton btnSave; private javax.swing.JButton btnUpdate; private javax.swing.JButton btn_backward; private javax.swing.JButton btn_backward1; private javax.swing.JButton btn_forward; private javax.swing.JButton btn_forward1; private javax.swing.JButton btn_print; private javax.swing.JButton
Richard MacCutchan
Никто не собирается пробиваться через это, чтобы найти линию 691 (если это действительно правильное место). Пожалуйста, отредактируйте свой вопрос, удалите код, который не имеет отношения к проблеме, и объясните, где именно возникает проблема.