private void jMenuItemFileLoadMatrixActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemFileLoadMatrixActionPerformed
        NamedInputStream selectedInputStream = null;
        try {
            logger.info("Loading scoring matrix...");
            selectedInputStream = FileChooserFactory.getFileChooser().open();
            if (selectedInputStream != null) {
                Matrix matrix = MatrixLoader.load(selectedInputStream);

                // Put the loaded matrix in the matrices hashmap
                matrices.put(selectedInputStream.getName(), matrix);
                
                boolean found = false;
                int index = 0;
                int count = jComboBoxScoringMatrix.getItemCount();
                while (index < count && !found) {
                    if (((String)jComboBoxScoringMatrix.getItemAt(index)).equalsIgnoreCase(selectedInputStream.getName())) {
                        found = true;
                    } else {
                        index++;
                    }
                }
                if (!found) {
                    // Add the loaded matrix to the scoring matrices dropdown menu
                    jComboBoxScoringMatrix.addItem(selectedInputStream.getName());
                    index = jComboBoxScoringMatrix.getItemCount()-1;
                }
                // Set the selected item to the new loaded matrix
                jComboBoxScoringMatrix.setSelectedIndex(index);
                
                logger.info("Finished loading scoring matrix");
            } else {
                logger.info("Canceled loading scoring matrix");
            }
        } catch (Exception e) {
            String message = "Failed loading scoring matrix: " + e.getMessage();
            logger.log(Level.SEVERE, message, e);
            showErrorMessage(message);
        } finally {
            if (selectedInputStream != null) {
                try {
                    selectedInputStream.getInputStream().close();
                } catch(Exception e) {
                    logger.log(Level.WARNING, "Failed closing input stream: " + e.getMessage(), e);
                }
            }
        }
    }//GEN-LAST:event_jMenuItemFileLoadMatrixActionPerformed