本文整理了Java中javax.swing.JComponent.addKeyListener()
方法的一些代码示例,展示了JComponent.addKeyListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JComponent.addKeyListener()
方法的具体详情如下:
包路径:javax.swing.JComponent
类名称:JComponent
方法名:addKeyListener
暂无
代码示例来源:origin: mabe02/lanterna
component.addKeyListener(new TerminalInputListener());
component.addMouseListener(new TerminalMouseListener() {
@Override
代码示例来源:origin: org.netbeans.api/org-openide-awt
/**
* Set the enabled state of the quick search.
* This allows to activate/deactivate the quick search functionality.
* @param enabled <code>true</code> to enable the quick search,
* <code>false</code> otherwise.
*/
public void setEnabled(boolean enabled) {
if (this.enabled == enabled) {
return ;
}
this.enabled = enabled;
if (enabled) {
component.addKeyListener(quickSearchKeyAdapter);
} else {
removeSearchField();
component.removeKeyListener(quickSearchKeyAdapter);
}
}
代码示例来源:origin: stackoverflow.com
void example () {
JComponent component = ...;
component.addKeyListener(new KeyAdapter() {
@Override public void keyPressed (KeyEvent e) {
// do stuff
}
});
}
代码示例来源:origin: mucommander/mucommander
protected QuickSearch(JComponent component) {
this.component = component;
// Listener to key events to start quick search or update search string when it is active
component.addKeyListener(this);
}
代码示例来源:origin: org.netbeans.api/org-openide-awt
component.addKeyListener(quickSearchKeyAdapter);
代码示例来源:origin: MegaMek/megamek
protected void addBag(JComponent comp, GridBagLayout gridbag,
GridBagConstraints c) {
gridbag.setConstraints(comp, c);
add(comp);
comp.addKeyListener(this);
}
代码示例来源:origin: org.boofcv/boofcv-swing
/**
* If a component is added here then keyboard and mouse events will be used to control the
* image processing.
*
* @param comp
*/
public void addComponent(JComponent comp) {
comp.addMouseListener(this);
comp.addKeyListener(this);
}
代码示例来源:origin: org.boofcv/visualize
/**
* If a component is added here then keyboard and mouse events will be used to control the
* image processing.
*
* @param comp
*/
public void addComponent(JComponent comp) {
comp.addMouseListener(this);
comp.addKeyListener(this);
}
代码示例来源:origin: lbalazscs/Pixelitor
private static void addFocusArrowListener(JComponent jc) {
/** Check to see if someone already added this kind of listener:
*/
KeyListener[] listeners = jc.getKeyListeners();
for(int a = 0; a<listeners.length; a++) {
if(listeners[a] instanceof FocusArrowListener)
return;
}
//Add our own:
jc.addKeyListener(new FocusArrowListener());
}
代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop
public void propertyChange(PropertyChangeEvent e) {
if (e.getPropertyName().equals("editor")) {
ComboBoxEditor editor = comboBox.getEditor();
if (editor!=null && editor.getEditorComponent()!=null) {
JComponent editorComponent = (JComponent) comboBox.getEditor().getEditorComponent();
editorComponent.addKeyListener(this);
editorComponent.setBorder(null);
}
}
}
}
代码示例来源:origin: otros-systems/otroslogviewer
private JPopupMenu addPopupMenuWithActionFromActionMap(JComponent list, String... actions) {
JPopupMenu favoritesPopupMenu = new JPopupMenu();
for (String action : actions) {
favoritesPopupMenu.add(list.getActionMap().get(action));
}
list.addKeyListener(new pl.otros.logview.gui.PopupListener(favoritesPopupMenu));
list.addMouseListener(new pl.otros.logview.gui.PopupListener(favoritesPopupMenu));
return favoritesPopupMenu;
}
代码示例来源:origin: qeesung/HighlightBracketPair
public HighlightEditorComponent(Editor editor) {
this.editor = editor;
this.extraHighlightTrigger = new ExtraHighlightTrigger(this);
this.editor.getContentComponent().addKeyListener(this.extraHighlightTrigger);
editor.getCaretModel().addCaretListener(this);
}
代码示例来源:origin: org.nuiton/nuiton-widgets
public void install(JComponent attachedComponent) {
//attachedComponent.addCaretListener(this);
attachedComponent.addComponentListener(this);
attachedComponent.addFocusListener(this);
attachedComponent.addKeyListener(this);
attachedComponent.addMouseListener(this);
attachedComponent.addMouseMotionListener(this);
}
代码示例来源:origin: org.fudaa.framework.ebli/ebli-common
protected void setEnterAction(final JComponent _cp) {
final KeyListener l = getEnterAction();
// on ajoute le listener que s'il n'est pas pr�sent.
if (CtuluLibArray.findObject(_cp.getKeyListeners(), l) < 0) {
_cp.addKeyListener(getEnterAction());
}
}
代码示例来源:origin: io.ultreia.java4all.jaxx/jaxx-widgets-extra
public void install(JComponent attachedComponent) {
//attachedComponent.addCaretListener(this);
attachedComponent.addComponentListener(this);
attachedComponent.addFocusListener(this);
attachedComponent.addKeyListener(this);
attachedComponent.addMouseListener(this);
attachedComponent.addMouseMotionListener(this);
}
代码示例来源:origin: stackoverflow.com
public void registerComponent(JComponent component) {
component.removeMouseListener(this);
component.addMouseListener(this);
component.removeMouseMotionListener(moveBeforeEnterListener);
component.addMouseMotionListener(moveBeforeEnterListener);
component.removeKeyListener(accessibilityKeyListener);
component.addKeyListener(accessibilityKeyListener);
}
代码示例来源:origin: lbalazscs/Pixelitor
@Override
public void installUI(JComponent slider) {
slider.addMouseListener(this);
slider.addMouseMotionListener(this);
slider.addFocusListener(focusListener);
slider.addKeyListener(keyListener);
slider.addComponentListener(compListener);
slider.addPropertyChangeListener(propertyListener);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui
void registerForComponent(JComponent component) {
if (component == null) {
return;
}
component.addComponentListener(this);
component.addKeyListener(this);
component.addFocusListener(this);
component.addPropertyChangeListener(this);
component.addHierarchyListener(this);
component.addHierarchyBoundsListener(this);
}
代码示例来源:origin: org.gephi/ui-components
@Override
public void installUI(JComponent slider) {
slider.addMouseListener(this);
slider.addMouseMotionListener(this);
slider.addFocusListener(focusListener);
slider.addKeyListener(keyListener);
slider.addComponentListener(compListener);
slider.addPropertyChangeListener(propertyListener);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-dlight-visualizers
void registerForComponent(JComponent component) {
if (component == null) {
return;
}
component.addComponentListener(this);
component.addKeyListener(this);
component.addFocusListener(this);
component.addPropertyChangeListener(this);
component.addHierarchyListener(this);
component.addHierarchyBoundsListener(this);
}
内容来源于网络,如有侵权,请联系作者删除!