Example usage for javax.swing JComboBox setRequestFocusEnabled

List of usage examples for javax.swing JComboBox setRequestFocusEnabled

Introduction

In this page you can find the example usage for javax.swing JComboBox setRequestFocusEnabled.

Prototype

public void setRequestFocusEnabled(boolean requestFocusEnabled) 

Source Link

Document

Provides a hint as to whether or not this JComponent should get focus.

Usage

From source file:com.aw.swing.mvp.binding.component.BndSJTable.java

private JComboBox getJComboBox(ComboBoxModel comboBoxModel) {
    final JComboBox jComboBox = new JComboBox(comboBoxModel);
    jComboBox.addFocusListener(new CellEditableFocusListener());
    jComboBox.setRequestFocusEnabled(true);
    jComboBox.putClientProperty(CellEditorUtils.AW_CELL_EDITOR, Boolean.TRUE);
    jComboBox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
    jComboBox.addAncestorListener(new AncestorListener() {
        public void ancestorAdded(AncestorEvent event) {
            jComboBox.requestFocusInWindow();
        }/*from   ww  w. j ava2 s. c  o  m*/

        public void ancestorMoved(AncestorEvent event) {
        }

        public void ancestorRemoved(AncestorEvent event) {
        }
    });
    return jComboBox;
}