private void jButtonSourceNextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSourceNextActionPerformed
        try{
            MultiSyntaxDocument syntax = new MultiSyntaxDocument();
            if(sourceCurrentPosition==(sourceMatchOffsets.length-1)){
                JOptionPane optionPane = new JOptionPane();
                int selection = optionPane.showConfirmDialog(this, "Reached end of file, continue from begining?", "Continue Search?",JOptionPane.YES_NO_OPTION);
                if(selection == 0){
                    //remove previous highlighting
                    syntax.setSearchHighlighting(sourceDoc, sourceMatchOffsets[sourceCurrentPosition][0], sourceMatchOffsets[sourceCurrentPosition][1]);
                    //set new highlighting
                    sourceCurrentPosition = 0;
                    jTextPaneSource.setCaretPosition(0);//reset the textPane
                    jTextPaneSource.setCaretPosition(sourceMatchOffsets[sourceCurrentPosition][0]);
                    syntax.setSelectedSearchHighlighting(sourceDoc, sourceMatchOffsets[sourceCurrentPosition][0], sourceMatchOffsets[sourceCurrentPosition][1]);
                }
                return;
            }
            //remove previous highlighting
            syntax.setSearchHighlighting(sourceDoc, sourceMatchOffsets[sourceCurrentPosition][0], sourceMatchOffsets[sourceCurrentPosition][1]);
            //set new highlighting
            ++sourceCurrentPosition;
            jTextPaneSource.setCaretPosition(0);//reset the textPane
            jTextPaneSource.setCaretPosition(sourceMatchOffsets[sourceCurrentPosition][0]);
            syntax.setSelectedSearchHighlighting(sourceDoc, sourceMatchOffsets[sourceCurrentPosition][0], sourceMatchOffsets[sourceCurrentPosition][1]);
        }//end try
        catch(Exception x){
            JOptionPane.showMessageDialog(this, "Error: " + x, "Applet Error", JOptionPane.ERROR_MESSAGE);
        }
    }//GEN-LAST:event_jButtonSourceNextActionPerformed