package jiamian;import java.awt.*;import javax.swing.*;import java.awt.event.*;class jianpan extends JPanel implements KeyListener{ JPanel panel =new JPanel(); public void keyTyped(KeyEvent e) { } public void keyPressed(KeyEvent e) { System.out.println("键盘输入"); } public void keyReleased(KeyEvent e) { } public void paint(Graphics g){ super.paint(g); } jianpan(){ panel.addKeyListener(this); }}public class heh { public static void main(String[] args){ jianpan jian=new jianpan(); }}
添加回答
举报
0/150
提交
取消