Example usage for javax.swing JList getInputMap

List of usage examples for javax.swing JList getInputMap

Introduction

In this page you can find the example usage for javax.swing JList getInputMap.

Prototype

public final InputMap getInputMap(int condition) 

Source Link

Document

Returns the InputMap that is used during condition.

Usage

From source file:pl.otros.vfs.browser.VfsBrowser.java

License:asdf

private void addOpenActionToList(final JList favoritesList) {
    favoritesList.getActionMap().put(ACTION_OPEN, new OpenSelectedFavorite(this, favoritesList));
    favoritesList.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1) {
                favoritesList.getActionMap().get(ACTION_OPEN).actionPerformed(null);
            }/*from  www  . j  a  v  a 2s. c o m*/
        }
    });
    InputMap favoritesListInputMap = favoritesList.getInputMap(JComponent.WHEN_FOCUSED);
    favoritesListInputMap.put(KeyStroke.getKeyStroke("ENTER"), ACTION_OPEN);
}

From source file:pl.otros.vfs.browser.VfsBrowser.java

License:asdf

private void addEditActionToList(final JList favoritesList, final MutableListModel<Favorite> listModel) {
    favoritesList.getActionMap().put(ACTION_EDIT, new EditFavorite(favoritesList, listModel));

    InputMap favoritesListInputMap = favoritesList.getInputMap(JComponent.WHEN_FOCUSED);
    favoritesListInputMap.put(KeyStroke.getKeyStroke("F2"), ACTION_EDIT);
}