// ! [11]
  private void createFilesTable() {
    filesTable = new QTableWidget(0, 2);

    List<String> labels = new LinkedList<String>();
    labels.add(tr("File Name"));
    labels.add(tr("Size"));

    filesTable.setHorizontalHeaderLabels(labels);
    filesTable.horizontalHeader().setSectionResizeMode(0, QHeaderView.ResizeMode.Stretch);
    filesTable.verticalHeader().hide();
    filesTable.setShowGrid(false);
  }
  // ! [8]
  private void showFiles(QDir directory, List<String> files) {
    for (int i = 0; i < files.size(); ++i) {
      QFile file = new QFile(directory.absoluteFilePath(files.get(i)));
      long size = new QFileInfo(file).size();

      QTableWidgetItem fileNameItem = new QTableWidgetItem(files.get(i));
      fileNameItem.setFlags(Qt.ItemFlag.ItemIsEnabled);
      QTableWidgetItem sizeItem = new QTableWidgetItem("" + ((size + 1023) / 1024) + tr("KB"));
      sizeItem.setTextAlignment(
          new Qt.Alignment(Qt.AlignmentFlag.AlignRight, Qt.AlignmentFlag.AlignVCenter).value());
      sizeItem.setFlags(Qt.ItemFlag.ItemIsEnabled);

      int row = filesTable.rowCount();
      filesTable.insertRow(row);
      filesTable.setItem(row, 0, fileNameItem);
      filesTable.setItem(row, 1, sizeItem);
    }
    filesFoundLabel.setText("" + files.size() + tr("file(s) found."));
  }
  // ! [3]
  private void find() {
    filesTable.setRowCount(0);

    String fileName = fileComboBox.currentText();
    String text = textComboBox.currentText();
    String path = directoryComboBox.currentText();
    // ! [3]

    // ! [4]
    QDir directory = new QDir(path);
    List<String> files = new LinkedList<String>();

    if (fileName.equals("")) fileName = "*";

    List<String> entries = new LinkedList<String>();
    entries.add(fileName);

    files =
        directory.entryList(entries, new QDir.Filters(QDir.Filter.Files, QDir.Filter.NoSymLinks));

    if (!text.equals("")) files = findFiles(directory, files, text);
    showFiles(directory, files);
  }