本文整理了Java中javax.swing.text.JTextComponent.addKeyListener()
方法的一些代码示例,展示了JTextComponent.addKeyListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextComponent.addKeyListener()
方法的具体详情如下:
包路径:javax.swing.text.JTextComponent
类名称:JTextComponent
方法名:addKeyListener
暂无
代码示例来源:origin: geotools/geotools
@Override
public void removeListener(Controller controller) {
text.addKeyListener(controller);
}
代码示例来源:origin: geotools/geotools
public void addListener(Controller controller) {
text.addKeyListener(controller);
}
代码示例来源:origin: geotools/geotools
public JComponent doLayout() {
if (parameter.metadata != null
&& parameter.metadata.get(Parameter.IS_PASSWORD) == Boolean.TRUE) {
text = new JPasswordField(32);
} else if (single) {
text = new JTextField(32);
} else {
text = new JTextArea(40, 2);
((JTextArea) text).setWrapStyleWord(true);
}
text.addKeyListener(
new KeyAdapter() {
public void keyReleased(KeyEvent e) {
validate();
}
});
if (text instanceof JTextArea) {
JScrollPane scroll =
new JScrollPane(
text,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
scroll.setPreferredSize(new Dimension(400, 80));
return scroll;
}
return text;
}
代码示例来源:origin: pentaho/mondrian
editor.addKeyListener(
new KeyAdapter() {
public void keyPressed(KeyEvent e) {
代码示例来源:origin: stackoverflow.com
JTextComponent editor = (JTextComponent) urCombo.getEditor().getEditorComponent();
editor.addKeyListener(new KeyAdapter() {
public void keyReleased(KeyEvent evt) {
// your code
}
});
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib
public KeyEventBlocker(JTextComponent component, boolean discardFirstKeyTypedEvent) {
this.component = component;
this.discardKeyTyped = discardFirstKeyTypedEvent;
this.component.addKeyListener(this);
}
代码示例来源:origin: org.geotools/gt-swing
@Override
public void removeListener(Controller controller) {
text.addKeyListener( controller );
}
代码示例来源:origin: org.geotools/gt-swing
public void addListener( Controller controller ){
text.addKeyListener( controller );
}
代码示例来源:origin: mucommander/mucommander
public void addKeyListener(KeyAdapter adapter) { textComponent.addKeyListener(adapter); }
代码示例来源:origin: stackoverflow.com
private JTextComponent comboboxEditor;
Vector ComboData = new Vector();
public void addActionListners() {
//adding action listner to the NameComboBox
this.comboboxEditor = (JTextComponent) yourCombo.getEditor().getEditorComponent();
comboboxEditor.addKeyListener(new KeyAdapter() {
public void keyReleased(KeyEvent evt) {
int i = evt.getKeyCode();
if (i == 10) {
//combobox action on enter
ComboData.add(comboboxEditor.getText());
yourCombo.setListData(ComboData);
}
}
});
}
代码示例来源:origin: notzippy/JALOPY2-MAIN
public void add()
{
this.component.addMouseListener(this.mouseHandler);
this.component.addKeyListener(this.keyHandler);
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-editor
void registerListeners()
{
unregisterListeners();
_editor.addKeyListener( _editorKeyListener );
_editor.getDocument().addUndoableEditListener( _docListener );
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-editor
public SmartFixManager( GosuEditor gosuEditor )
{
_mode = SmartFixMode.NONE;
_gosuEditor = gosuEditor;
_editor = gosuEditor.getEditor();
_editor.addMouseMotionListener( this );
_editor.addKeyListener( this );
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-lab
public SmartFixManager( GosuEditor gosuEditor )
{
_mode = SmartFixMode.NONE;
_gosuEditor = gosuEditor;
_editor = gosuEditor.getEditor();
_editor.addMouseMotionListener( this );
_editor.addKeyListener( this );
}
代码示例来源:origin: zgqq/mah
private void initKeybind() {
JTextComponent input = inputPane.getInput();
input.addKeyListener(new KeyHandler());
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib
/** Creates a new instance of PopupManager */
public PopupManager(JTextComponent textComponent) {
this.textComponent = textComponent;
keyListener = new PopupKeyListener();
textComponent.addKeyListener(keyListener);
componentListener = new TextComponentListener();
textComponent.addComponentListener(componentListener);
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-lab
@Override
protected void registerListeners()
{
unregisterListeners();
getEditor().addKeyListener( _editorKeyListener );
getEditor().getDocument().addUndoableEditListener( _docListener );
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-editor
@Override
protected void registerListeners()
{
unregisterListeners();
getEditor().addKeyListener( _editorKeyListener );
getEditor().getDocument().addUndoableEditListener( _docListener );
}
代码示例来源:origin: triplea-game/triplea
void configureEditor(final ComboBoxEditor newEditor) {
if (editor != null) {
editor.removeKeyListener(editorKeyListener);
editor.removeFocusListener(editorFocusListener);
}
if (newEditor != null) {
editor = (JTextComponent) newEditor.getEditorComponent();
editor.addKeyListener(editorKeyListener);
editor.addFocusListener(editorFocusListener);
editor.setDocument(this);
}
}
代码示例来源:origin: net.sf.cuf/cuf-swing
void configureEditor(final ComboBoxEditor pNewEditor)
{
if (mEditor != null)
{
mEditor.removeKeyListener(mEditorKeyListener);
mEditor.removeFocusListener(mEditorFocusListener);
}
if (pNewEditor != null)
{
mEditor = (JTextComponent) pNewEditor.getEditorComponent();
mEditor.addKeyListener(mEditorKeyListener);
mEditor.addFocusListener(mEditorFocusListener);
mEditor.setDocument(this);
}
}
内容来源于网络,如有侵权,请联系作者删除!