Search in sources :

Example 1 with SearchField

use of com.android.tools.idea.ui.SearchField in project android by JetBrains.

the class IconPickerDialog method createUIComponents.

private void createUIComponents() {
    mySearchField = new SearchField(false);
    mySearchField.addDocumentListener(new DocumentAdapter() {

        @Override
        protected void textChanged(DocumentEvent e) {
            updateFilter();
        }
    });
}
Also used : SearchField(com.android.tools.idea.ui.SearchField) DocumentAdapter(com.intellij.ui.DocumentAdapter) DocumentEvent(javax.swing.event.DocumentEvent)

Example 2 with SearchField

use of com.android.tools.idea.ui.SearchField in project android by JetBrains.

the class ChooseResourceDialog method createSearchField.

@NotNull
private SearchField createSearchField() {
    SearchField searchField = new // no history: interferes with arrow down to jump into the list
    SearchField(// no history: interferes with arrow down to jump into the list
    false) {

        @Override
        protected void showPopup() {
        // Turn off search popup; we're overriding the Down key to jump into the list instead
        }
    };
    searchField.getTextEditor().addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {
            // Allow arrow down to jump directly into the list
            if (e.getKeyCode() == KeyEvent.VK_DOWN) {
                e.consume();
                getSelectedPanel().selectFirst();
            }
        }
    });
    searchField.setMaximumSize(new Dimension(JBUI.scale(300), searchField.getMaximumSize().height));
    searchField.addDocumentListener(new DocumentAdapter() {

        @Override
        protected void textChanged(DocumentEvent e) {
            updateFilter();
        }
    });
    return searchField;
}
Also used : SearchField(com.android.tools.idea.ui.SearchField) DocumentEvent(javax.swing.event.DocumentEvent) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

SearchField (com.android.tools.idea.ui.SearchField)2 DocumentEvent (javax.swing.event.DocumentEvent)2 DocumentAdapter (com.intellij.ui.DocumentAdapter)1 NotNull (org.jetbrains.annotations.NotNull)1