@SuppressWarnings("unchecked") @Override public void actionPerformed(ActionEvent e) { Object Event = e.getSource(); if (Event == Searched) { // Code for Searching the Stock , i.e SELECT STATEMENT Model St_search = new Model( username, password); // calls model passing in username and password for database // needs work ResultSet cursor = St_search.DisplayStock(); System.out.println("displaying set of stock"); Vector<String> t = new Vector<String>(); try { while (cursor.next()) { String name, director; int id = cursor.getInt("stockId"); name = cursor.getString("dvdTitle"); int year = cursor.getInt("dvdYear"); director = cursor.getString("dvdDirector"); int quant = cursor.getInt("dvdQuant"); int rentfee = cursor.getInt("dvdRentFee"); System.out.println( "Id : " + id + " Name: " + name + " year:" + year + " director:" + director + " quantity:" + quant + " rentfee:" + rentfee); System.out.println("testing add to vector t"); t.add( "Id: " + id + " Name: " + name + " year: " + year + " director: " + director + " quantity: " + quant + " rentfee: " + rentfee); System.out.println("testing after adding to vector t"); } System.out.println("testing display"); Films.setListData(t); System.out.println("testing after display"); System.out.println("closing stock cursor"); cursor.close(); System.out.println("successfully closed"); } catch (SQLException e2) { // TODO Auto-generated catch block e2.printStackTrace(); } St_search.closeResultSet(); St_search.closeStm(); // closes the statement St_search.closeDB(); // closes the database when finished } if (Event == cancel) { this.setVisible(false); } if (Event == Display_instock) { // Code for Searching the Stock , i.e SELECT STATEMENT Model St_search = new Model( username, password); // calls model passing in username and password for database // needs work ResultSet cursor = St_search.DisplayinStock(); System.out.println("displaying set of stock"); Vector<String> t = new Vector<String>(); try { while (cursor.next()) { String name, director; int id = cursor.getInt("stockId"); name = cursor.getString("dvdTitle"); int year = cursor.getInt("dvdYear"); director = cursor.getString("dvdDirector"); int quant = cursor.getInt("dvdQuant"); int rentfee = cursor.getInt("dvdRentFee"); String state = cursor.getString("dvdState"); System.out.println( "Id : " + id + " Name: " + name + " year:" + year + " director:" + director + " quantity:" + quant + " rentfee:" + rentfee + " State :" + state); System.out.println("testing add to vector t"); t.add( "Id: " + id + " Name: " + name + " year: " + year + " director: " + director + " quantity: " + quant + " rentfee: " + rentfee + " State :" + state); System.out.println("testing after adding to vector t"); } System.out.println("testing display"); Films.setListData(t); System.out.println("testing after display"); System.out.println("closing stock cursor"); cursor.close(); System.out.println("successfully closed"); } catch (SQLException e2) { // TODO Auto-generated catch block e2.printStackTrace(); } St_search.closeResultSet(); St_search.closeStm(); // closes the statement St_search.closeDB(); // closes the database when finished } if (Event == goBack) { this.setVisible(false); } if (Event == confirm) { int No_days = Integer.parseInt(Days.getText()); System.out.println("" + No_days); System.out.println("" + Films.getSelectedValue()); System.out.println("id :" + Films.getSelectedValue().toString().charAt(4)); String ch = "" + Films.getSelectedValue().toString().charAt(4); int stockId = Integer.parseInt(ch); System.out.println("Stock id:" + stockId); Model ren = new Model(username, password); System.out.println("Stock id:" + stockId); System.out.println("Attempting rent in newrent"); ren.RentNew(No_days, stockId, custId); System.out.println("Rent successful"); } }