private void traverseFileNames(String fixed, Pattern pattern, boolean forward) {
        currentCount = 0;
        estimatedTotalCount = 1000;
        final ArrayList selectedFileNames = new ArrayList();
        Exchange ex = null;
        StringBuilder sb = new StringBuilder();
        try {
            ex = persistit.getExchange("ffdemo", "filenames", true);
            ex.clear().append(forward ? "L2R" : "R2L");
            //
            // Construct a KeyFilter that accepts all keys within the
            // designated subtree.
            //
            KeyFilter filter = new KeyFilter(ex.getKey());
            if (fixed.length() != 0) {
                String end = fixed.substring(0, fixed.length() - 1)
                        + new Character((char) (fixed.charAt(fixed.length() - 1) + 1));
                //
                // append a Term that selects only the range accepted by the
                // fixed portion of the name.
                //
                filter = filter.append(KeyFilter.rangeTerm(fixed, end));
            }
            while (ex.next(filter)) {
                String fileName = ex.getKey().indexTo(1).decodeString();
                if (!forward) {
                    sb.setLength(0);
                    sb.append(fileName);
                    fileName = sb.reverse().toString();
                }
                //
                // Apply the Regex pattern, and if the name matches,
                // add it to the list model.
                //
                if (pattern.matcher(fileName).matches()) {
                    selectedFileNames.add(fileName);
                    currentCount++;
                    if (currentCount + 200 > estimatedTotalCount) {
                        estimatedTotalCount += 500;
                    }
                    if (currentCount % 100 == 0) {
                        adjustProgressBar(currentCount, estimatedTotalCount);
                    }
                }
            }
            estimatedTotalCount = currentCount;
            adjustProgressBar(currentCount, currentCount);
            setEnabled(searchField, true);

            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    int size = selectedFileNames.size();
                    for (int index = 0; index < size; index++) {
                        listModel.addElement(selectedFileNames.get(index));
                    }
                }
            });
        } catch (PersistitException pe) {
            pe.printStackTrace();
        } finally {
            persistit.releaseExchange(ex);
        }
    }