MCPcopy Create free account
hub / github.com/DuGuQiuBai/Java / keyPressed

Method keyPressed

day25/code/day25_Frame/src/cn/itcast_06/KeyDemo.java:42–50  ·  view source on GitHub ↗
(KeyEvent e)

Source from the content-addressed store, hash-verified

40
41 tf.addKeyListener(new KeyAdapter() {
42 @Override
43 public void keyPressed(KeyEvent e) {
44 // public char getKeyChar()
45 char ch = e.getKeyChar();
46 if (!(ch >= KeyEvent.VK_0 && ch <= KeyEvent.VK_9)) {
47 System.out.println("��������ǣ�" + ch);
48 e.consume();
49 }
50 }
51 });
52
53 // ���ÿɼ�

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected