JAVA中的图形用户界面示例

kly_37243 26 0 PPT 2019-06-04 18:06:29

【例9.24】综合鼠标事件和键盘事件处理的程序,模拟一个电子白板,可以用鼠标在上面绘画,可用键盘在上面写字。importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;publicclassMouseAndKeyDemoextendsJApplet{protectedintlastX=0,lastY=0;publicvoidinit(){setBackground(Color.white);setForeground(Color.blue);addMouseListener(newPositionRecorder());

用户评论
请输入评论内容
评分:
暂无评论