Buggy code:
private JPanel checkPanel ; private JPanel topPanel ; private JPanel bottomPanel ; private JButton create ; private JButton checkB ; private JButton clearB ; private JButton cancel ; private final int [ ] HRS24 = new int [ ] { 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 } ; private final String [ ] HOURS = new String [ ] { "10<seq2seq4repair_space>am" , "11<seq2seq4repair_space>am" , "12<seq2seq4repair_space>pm" , "1<seq2seq4repair_space>pm" , "2<seq2seq4repair_space>pm" , "3<seq2seq4repair_space>pm" , "4<seq2seq4repair_space>pm" , "5<seq2seq4repair_space>pm" , "6<seq2seq4repair_space>pm" , "7<seq2seq4repair_space>pm" , "8<seq2seq4repair_space>pm" , "9<seq2seq4repair_space>pm" , "10<seq2seq4repair_space>pm" , "11<seq2seq4repair_space>pm" } ; private final String [ ] MINUTES = new String [ ] { "00" , "15" , "30" , "45" } ; private final int [ ] LANES = new int [ ] { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 } ; private int games_hours ; public CheckAvailabilityGUI ( MainScreen ms , BookingTab bt , MainProgramOperations po , ArrayList < Booking > b , Staff user ) { } public void actionPerformed ( ActionEvent e ) { System . out . println ( "Inside<seq2seq4repair_space>:<seq2seq4repair_space>ActionPerformed()<seq2seq4repair_space>in<seq2seq4repair_space>CheckAvailabilityGUI" ) ; NumberValidator numValidator = new NumberValidator ( ) ; if ( e . getSource ( ) . equals ( checkB ) ) { try { if ( ( ( ( dateInTxt . getText ( ) . equals ( "" ) ) || ( startTimeTxt . getText ( ) . equals ( "" ) ) ) || ( endTimeTxt . getText ( ) . equals ( "" ) ) ) || ( playerTxt . getText ( ) . equals ( "" ) ) ) { JOptionPane . showMessageDialog ( null , ( "Fields<seq2seq4repair_space>cannot<seq2seq4repair_space>be<seq2seq4repair_space>blank!\n" + "Please<seq2seq4repair_space>input<seq2seq4repair_space>all<seq2seq4repair_space>details." ) , "ERROR" , JOptionPane . WARNING_MESSAGE ) ; } else { String d = dateInTxt . getText ( ) ; String st = startTimeTxt . getText ( ) ; String et = endTimeTxt . getText ( ) ; if ( numValidator . isNumeric ( playerTxt . getText ( ) ) ) { noLanes . removeAllItems ( ) ; int laneIndex = ( ( int ) ( Math . ceil ( ( ( ( double ) ( Integer . parseInt ( playerTxt . getText ( ) ) ) ) // 6 ) ) ) ) - 1 ; for ( int i = laneIndex ; i < ( LANES . length ) ; i ++ ) { noLanes . addItem ( LANES [ i ] ) ; } int available = 0 ; rSet = progOps . checkAvailability ( d , st , et ) ; try { while ( rSet . next ( ) ) { available = rSet . getInt ( 1 ) ; } display . setText ( ( ( ( ( "Lanes<seq2seq4repair_space>Available:<seq2seq4repair_space>" + available ) + "\nLanes<seq2seq4repair_space>Required:<seq2seq4repair_space>" ) + ( noLanes . getSelectedItem ( ) ) ) + "\n\n" ) ) ; if ( available >= ( ( Integer ) ( noLanes . getSelectedItem ( ) ) ) ) { display . append ( "SUCCESS,<seq2seq4repair_space>there<seq2seq4repair_space>are<seq2seq4repair_space>lanes<seq2seq4repair_space>available!" ) ; create . setVisible ( true ) ; } else { display . append ( "Insufficient<seq2seq4repair_space>Lanes<seq2seq4repair_space>available!" ) ; create . setVisible ( false ) ; } } catch ( SQLException ex ) { System . out . println ( e ) ; } } else { JOptionPane . showMessageDialog ( null , "No<seq2seq4repair_space>of<seq2seq4repair_space>Players<seq2seq4repair_space>must<seq2seq4repair_space>be<seq2seq4repair_space>numeric" , "ERROR" , JOptionPane . WARNING_MESSAGE ) ; } } } catch ( NumberFormatException nf ) { JOptionPane . showMessageDialog ( null , "Wrong<seq2seq4repair_space>data<seq2seq4repair_space>format" , "ERROR" , JOptionPane . WARNING_MESSAGE ) ; } } else if ( ( e . getSource ( ) ) == ( create ) ) { int lanes = ( ( Integer ) ( noLanes . getSelectedItem ( ) ) ) ; int players = Integer . parseInt ( playerTxt . getText ( ) ) ; int [ ] freeLanes = progOps . getLanesAvailable ( dateInTxt . getText ( ) , startTimeTxt . getText ( ) , endTimeTxt . getText ( ) ) ; DateFormat formatter ; Date date = new Date ( ) ; try { formatter = new SimpleDateFormat ( "dd-MMM-yy" ) ; date = formatter . parse ( dateInTxt . getText ( ) ) ; } catch ( Exception exc ) { System . out . println ( exc ) ; } for ( int i = 0 ; i < ( ( Integer ) ( noLanes . getSelectedItem ( ) ) ) ; i ++ ) { int [ ] slots = progOps . getTimes ( startTimeTxt . getText ( ) , endTimeTxt . getText ( ) ) ; games_hours = progOps . getNumHours ( startTimeTxt . getText ( ) , endTimeTxt . getText ( ) ) ; for ( int j = 0 ; j < ( slots . length ) ; j ++ ) { <START_BUG> BookingDetails bd = new BookingDetails ( ( ( bookingList . size ( ) ) + 1 ) , freeLanes [ i ] , slots [ j ] , date ) ; <END_BUG> timeslots . add ( bd ) ; } } BookingForm reserve = new BookingForm ( user , ms , bt , this , progOps , bookingList , games_hours , lanes , players , timeslots ) ; addD . dispose ( ) ; } else if ( e . getSource ( ) . equals ( clearB ) ) { startTimeTxt . setText ( "" ) ; endTimeTxt . setText ( "" ) ; noLanes . removeAllItems ( ) ; playerTxt . setText ( "" ) ; display . setText ( "" ) ; create . setVisible ( false ) ; } else if ( e . getSource ( ) . equals ( cancel ) ) { addD . dispose ( ) ; } } @ Override public void itemStateChanged ( ItemEvent e ) { } }

Fix:
BookingDetails bd = new BookingDetails ( ( ( progOps . getNumBookings ( ) ) + 1 ) , freeLanes [ i ] , slots [ j ] , date ) ;