这个JPanel是用来画图的,上面没有任何有焦点的控件。
如何获得键盘事件?panel.addKeyListener(new KeyAdapter(){
public void keyTyped(KeyEvent e){
......
}
}
);
不行,处理方法根本不被调用参考
http://expert.csdn.net/Expert/topic/1238/1238484.xml?temp=.617901
两贴一起结算
如何获得键盘事件?panel.addKeyListener(new KeyAdapter(){
public void keyTyped(KeyEvent e){
......
}
}
);
不行,处理方法根本不被调用参考
http://expert.csdn.net/Expert/topic/1238/1238484.xml?temp=.617901
两贴一起结算
要么换用其他的如JTextPane等组件,都可以画图。要么自己实现。
用panel监听也不行?
这个JFrame拥有JPanel的引用是很容易,同样可以对JPANEL进行各种操作
so it has the Methods of requestFocus(),this will let the JPanel get the focus.