本文整理了Java中javax.swing.JLabel.addKeyListener()
方法的一些代码示例,展示了JLabel.addKeyListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JLabel.addKeyListener()
方法的具体详情如下:
包路径:javax.swing.JLabel
类名称:JLabel
方法名:addKeyListener
暂无
代码示例来源:origin: org.gosu-lang.gosu/gosu-lab
@Override
public void run()
{
label.requestFocus();
label.addKeyListener(
new KeyAdapter()
{
@Override
public void keyPressed( KeyEvent e )
{
label.removeKeyListener( this );
popup.setVisible( false );
}
} );
}
} );
代码示例来源:origin: org.gosu-lang.gosu/gosu-editor
@Override
public void run()
{
label.requestFocus();
label.addKeyListener(
new KeyAdapter()
{
@Override
public void keyPressed( KeyEvent e )
{
label.removeKeyListener( this );
popup.setVisible( false );
}
} );
}
} );
代码示例来源:origin: stackoverflow.com
final JLabel label = new JLabel("Text shall change with shortcut");
final KeyStroke key = KeyStroke.getKeyStroke((Character)'k',
InputEvent.CTRL_DOWN_MASK, false);
final Object actionKey = "auml";
final Action action = new AbstractAction() {
@Override
public void actionPerformed(ActionEvent event) {
System.out.println("aha");
label.setText("It is working!!!");
}
};
label.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(java.awt.event.KeyEvent e) {
if (e.isControlDown() && e.getKeyChar() == 'ä') {
System.out.println("Ctrl-ä");
label.getActionMap().get(actionKey).actionPerformed(null);
// return;
}
super.keyPressed(e);
}
});
label.getInputMap().put(key, actionKey);
label.getActionMap().put(actionKey, action);
代码示例来源:origin: vgrazi/java-concurrent-animated
snippetPane.setFocusable(true);
snippetPane.setFocusTraversalKeysEnabled(true);
snippetLabel.addKeyListener(keyListener);
snippetLabel.addMouseListener(new MouseAdapter() {
@Override
代码示例来源:origin: vgrazi/java-concurrent-animated
backgroundImage.addKeyListener(keyListener);
backgroundImage.requestFocus();
container.validate();
代码示例来源:origin: sc.fiji/TrakEM2_
buttons.addKeyListener(help);
empty.addKeyListener(help);
a.addKeyListener(help);
代码示例来源:origin: hneemann/Digital
textLabel.addKeyListener(new KeyAdapter() {
@Override
public void keyTyped(KeyEvent e) {
代码示例来源:origin: ontop/ontop
lblAddMappingKey.addKeyListener(new KeyListener(){
@Override
public void keyPressed(KeyEvent e) {
lblEditMappingBodyKey.addKeyListener(new KeyListener(){
@Override
public void keyPressed(KeyEvent e) {
lblEditMappingHeadKey.addKeyListener(new KeyListener(){
@Override
public void keyPressed(KeyEvent e) {
lblMappingIdKey.addKeyListener(new KeyListener(){
@Override
public void keyPressed(KeyEvent e) {
代码示例来源:origin: net.imagej/ij
double scale = Prefs.getGuiScale();
statusLine.setFont(new Font("SansSerif", Font.PLAIN, (int)(13*scale)));
statusLine.addKeyListener(this);
statusLine.addMouseListener(this);
statusBar.add("Center", statusLine);
代码示例来源:origin: imagej/ImageJA
double scale = Prefs.getGuiScale();
statusLine.setFont(new Font("SansSerif", Font.PLAIN, (int)(13*scale)));
statusLine.addKeyListener(this);
statusLine.addMouseListener(this);
statusBar.add("Center", statusLine);
内容来源于网络,如有侵权,请联系作者删除!