javax.swing.plaf.basic.BasicDirectoryModel Java Examples

The following examples show how to use javax.swing.plaf.basic.BasicDirectoryModel. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DarkFilePaneUIBridge.java    From darklaf with MIT License 6 votes vote down vote up
protected int getNextMatch(final int startIndex, final int finishIndex) {
    BasicDirectoryModel model = getModel();
    JFileChooser fileChooser = getFileChooser();
    DetailsTableRowSorter rowSorter = getRowSorter();

    String prefix = typedString.toString().toLowerCase();

    // Search element
    for (int index = startIndex; index <= finishIndex; index++) {
        File file = (File) model.getElementAt(rowSorter.convertRowIndexToModel(index));

        String fileName = fileChooser.getName(file).toLowerCase();

        if (fileName.startsWith(prefix)) {
            return index;
        }
    }

    return -1;
}
 
Example #2
Source File: GTKFileChooserUI.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public BasicDirectoryModel getModel() {
    return model;
}
 
Example #3
Source File: MainPanel.java    From java-swing-tips with MIT License 4 votes vote down vote up
@Override public BasicDirectoryModel getModel() {
  return model2;
}
 
Example #4
Source File: MainPanel.java    From java-swing-tips with MIT License 4 votes vote down vote up
@Override public BasicDirectoryModel getModel() {
  return model2;
}
 
Example #5
Source File: GTKFileChooserUI.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
public BasicDirectoryModel getModel() {
    return model;
}
 
Example #6
Source File: GTKFileChooserUI.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public BasicDirectoryModel getModel() {
    return model;
}
 
Example #7
Source File: GTKFileChooserUI.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
public BasicDirectoryModel getModel() {
    return model;
}
 
Example #8
Source File: GTKFileChooserUI.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public BasicDirectoryModel getModel() {
    return model;
}
 
Example #9
Source File: GTKFileChooserUI.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public BasicDirectoryModel getModel() {
    return model;
}
 
Example #10
Source File: GTKFileChooserUI.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public BasicDirectoryModel getModel() {
    return model;
}
 
Example #11
Source File: GTKFileChooserUI.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public BasicDirectoryModel getModel() {
    return model;
}
 
Example #12
Source File: GTKFileChooserUI.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public BasicDirectoryModel getModel() {
    return model;
}
 
Example #13
Source File: GTKFileChooserUI.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
public BasicDirectoryModel getModel() {
    return model;
}
 
Example #14
Source File: DarkFileChooserUIBridge.java    From darklaf with MIT License 4 votes vote down vote up
public BasicDirectoryModel getModel() {
    return DarkFileChooserUIBridge.this.getModel();
}
 
Example #15
Source File: GTKFileChooserUI.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public BasicDirectoryModel getModel() {
    return model;
}
 
Example #16
Source File: GTKFileChooserUI.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
public BasicDirectoryModel getModel() {
    return model;
}
 
Example #17
Source File: GTKFileChooserUI.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public BasicDirectoryModel getModel() {
    return model;
}
 
Example #18
Source File: GTKFileChooserUI.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public BasicDirectoryModel getModel() {
    return model;
}
 
Example #19
Source File: GTKFileChooserUI.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public BasicDirectoryModel getModel() {
    return model;
}
 
Example #20
Source File: GTKFileChooserUI.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
public BasicDirectoryModel getModel() {
    return model;
}
 
Example #21
Source File: DarkFilePaneUIBridge.java    From darklaf with MIT License 4 votes vote down vote up
protected BasicDirectoryModel getModel() {
    return fileChooserUIAccessor.getModel();
}
 
Example #22
Source File: DarkFilePaneUIBridge.java    From darklaf with MIT License 4 votes vote down vote up
/**
 * Moves the keyboard focus to the first element whose prefix matches
 * the sequence of alphanumeric keys pressed by the user with delay
 * less than value of <code>timeFactor</code>. Subsequent same key
 * presses move the keyboard focus to the next object that starts with
 * the same letter until another key is pressed, then it is treated
 * as the prefix with appropriate number of the same letters followed
 * by first typed another letter.
 */
public void keyTyped(final KeyEvent e) {
    BasicDirectoryModel model = getModel();
    int rowCount = model.getSize();

    if (detailsTable == null || rowCount == 0 ||
        e.isAltDown() || e.isControlDown() || e.isMetaDown()) {
        return;
    }

    InputMap inputMap = detailsTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    KeyStroke key = KeyStroke.getKeyStrokeForEvent(e);

    if (inputMap != null && inputMap.get(key) != null) {
        return;
    }

    int startIndex = detailsTable.getSelectionModel().getLeadSelectionIndex();

    if (startIndex < 0) {
        startIndex = 0;
    }

    if (startIndex >= rowCount) {
        startIndex = rowCount - 1;
    }

    char c = e.getKeyChar();

    long time = e.getWhen();

    if (time - lastTime < timeFactor) {
        if (typedString.length() == 1 && typedString.charAt(0) == c) {
            // Subsequent same key presses move the keyboard focus to the next
            // object that starts with the same letter.
            startIndex++;
        } else {
            typedString.append(c);
        }
    } else {
        startIndex++;

        typedString.setLength(0);
        typedString.append(c);
    }

    lastTime = time;

    if (startIndex >= rowCount) {
        startIndex = 0;
    }

    // Find next file
    int index = getNextMatch(startIndex, rowCount - 1);

    if (index < 0 && startIndex > 0) { // wrap
        index = getNextMatch(0, startIndex - 1);
    }

    if (index >= 0) {
        detailsTable.getSelectionModel().setSelectionInterval(index, index);

        Rectangle cellRect = detailsTable.getCellRect(index,
                                                      detailsTable.convertColumnIndexToView(COLUMN_FILENAME),
                                                      false);
        detailsTable.scrollRectToVisible(cellRect);
    }
}
 
Example #23
Source File: DarkFilePaneUIBridge.java    From darklaf with MIT License votes vote down vote up
BasicDirectoryModel getModel();