本文整理了Java中javax.swing.JComboBox.processKeyBinding()
方法的一些代码示例,展示了JComboBox.processKeyBinding()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JComboBox.processKeyBinding()
方法的具体详情如下:
包路径:javax.swing.JComboBox
类名称:JComboBox
方法名:processKeyBinding
暂无
代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core
/**
* {@inheritDoc}
*/
@Override
protected boolean processKeyBinding(KeyStroke ks, final KeyEvent e, int condition,
boolean pressed) {
boolean retValue = super.processKeyBinding(ks, e, condition, pressed);
if (!retValue && editor != null) {
if (isStartingCellEdit(e)) {
pendingEvents.add(e);
} else if (pendingEvents.size() == 2) {
pendingEvents.add(e);
isDispatching = true;
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
for (KeyEvent event : pendingEvents) {
editor.getEditorComponent().dispatchEvent(event);
}
pendingEvents.clear();
} finally {
isDispatching = false;
}
}
});
}
}
return retValue;
}
代码示例来源:origin: org.swinglabs.swingx/swingx-core
/**
* {@inheritDoc}
*/
@Override
protected boolean processKeyBinding(KeyStroke ks, final KeyEvent e, int condition,
boolean pressed) {
boolean retValue = super.processKeyBinding(ks, e, condition, pressed);
if (!retValue && editor != null) {
if (isStartingCellEdit(e)) {
pendingEvents.add(e);
} else if (pendingEvents.size() == 2) {
pendingEvents.add(e);
isDispatching = true;
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
for (KeyEvent event : pendingEvents) {
editor.getEditorComponent().dispatchEvent(event);
}
pendingEvents.clear();
} finally {
isDispatching = false;
}
}
});
}
}
return retValue;
}
代码示例来源:origin: org.swinglabs.swingx/swingx-all
/**
* {@inheritDoc}
*/
@Override
protected boolean processKeyBinding(KeyStroke ks, final KeyEvent e, int condition,
boolean pressed) {
boolean retValue = super.processKeyBinding(ks, e, condition, pressed);
if (!retValue && editor != null) {
if (isStartingCellEdit(e)) {
pendingEvents.add(e);
} else if (pendingEvents.size() == 2) {
pendingEvents.add(e);
isDispatching = true;
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
for (KeyEvent event : pendingEvents) {
editor.getEditorComponent().dispatchEvent(event);
}
pendingEvents.clear();
} finally {
isDispatching = false;
}
}
});
}
}
return retValue;
}
代码示例来源:origin: com.haulmont.thirdparty/swingx-core
/**
* {@inheritDoc}
*/
@Override
protected boolean processKeyBinding(KeyStroke ks, final KeyEvent e, int condition,
boolean pressed) {
boolean retValue = super.processKeyBinding(ks, e, condition, pressed);
if (!retValue && editor != null) {
if (isStartingCellEdit(e)) {
pendingEvents.add(e);
} else if (pendingEvents.size() == 2) {
pendingEvents.add(e);
isDispatching = true;
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
for (KeyEvent event : pendingEvents) {
editor.getEditorComponent().dispatchEvent(event);
}
pendingEvents.clear();
} finally {
isDispatching = false;
}
}
});
}
}
return retValue;
}
代码示例来源:origin: net.java.dev.glazedlists/glazedlists_java16
/**
* This method is called by Swing when the JComboBox is installed as a
* TableCellEditor. It gives the component a chance to process the
* KeyEvent. For example, a JTextField will honour the keystroke and
* add the letter to its Document.
*
* Editable JComboBoxes don't provide that expected behaviour out of
* the box, so we override this method with logic that gives the editor
* component of the JComboBox a chance to respond to the keystroke that
* initiated the cell edit.
*/
@Override
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) {
// let the textfield have a crack at processing the KeyEvent
final TableCellTextField tableCellTextField = (TableCellTextField) getEditor().getEditorComponent();
tableCellTextField.processKeyBinding(ks, e, condition, pressed);
// ensure the text field has focus if it is still processing key strokes
// (I've seen bad behaviour on windows textfield has no cursor, yet continues to process keystrokes
// - this helps to ensure that the textfield actually has focus and thus the cursor)
if (!tableCellTextField.hasFocus())
tableCellTextField.requestFocus();
// now let the JComboBox react (important for arrow keys to work as expected)
return super.processKeyBinding(ks, e, condition, pressed);
}
代码示例来源:origin: net.java.dev.glazedlists/glazedlists_java15
/**
* This method is called by Swing when the JComboBox is installed as a
* TableCellEditor. It gives the component a chance to process the
* KeyEvent. For example, a JTextField will honour the keystroke and
* add the letter to its Document.
*
* Editable JComboBoxes don't provide that expected behaviour out of
* the box, so we override this method with logic that gives the editor
* component of the JComboBox a chance to respond to the keystroke that
* initiated the cell edit.
*/
@Override
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) {
// let the textfield have a crack at processing the KeyEvent
final TableCellTextField tableCellTextField = (TableCellTextField) getEditor().getEditorComponent();
tableCellTextField.processKeyBinding(ks, e, condition, pressed);
// ensure the text field has focus if it is still processing key strokes
// (I've seen bad behaviour on windows textfield has no cursor, yet continues to process keystrokes
// - this helps to ensure that the textfield actually has focus and thus the cursor)
if (!tableCellTextField.hasFocus())
tableCellTextField.requestFocus();
// now let the JComboBox react (important for arrow keys to work as expected)
return super.processKeyBinding(ks, e, condition, pressed);
}
代码示例来源:origin: com.haulmont.thirdparty/glazedlists
/**
* This method is called by Swing when the JComboBox is installed as a
* TableCellEditor. It gives the component a chance to process the
* KeyEvent. For example, a JTextField will honour the keystroke and
* add the letter to its Document.
*
* Editable JComboBoxes don't provide that expected behaviour out of
* the box, so we override this method with logic that gives the editor
* component of the JComboBox a chance to respond to the keystroke that
* initiated the cell edit.
*/
@Override
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) {
// let the textfield have a crack at processing the KeyEvent
final TableCellTextField tableCellTextField = (TableCellTextField) getEditor().getEditorComponent();
tableCellTextField.processKeyBinding(ks, e, condition, pressed);
// ensure the text field has focus if it is still processing key strokes
// (I've seen bad behaviour on windows textfield has no cursor, yet continues to process keystrokes
// - this helps to ensure that the textfield actually has focus and thus the cursor)
if (!tableCellTextField.hasFocus())
tableCellTextField.requestFocus();
// now let the JComboBox react (important for arrow keys to work as expected)
return super.processKeyBinding(ks, e, condition, pressed);
}
内容来源于网络,如有侵权,请联系作者删除!