图画笔paint
package gui.lesson01.lesson03;
import java.awt.*;
public class TextPaint {
public static void main(String[] args) {
new MyPaint().myFrame();
}
}
class MyPaint extends Frame {
public void myFrame(){
鼠标监听事件
package gui.lesson01.lesson03;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.Iterator;
public class TextMouseListener {
public static void main(String[] args) {
new MyFrame03("画画");
}
}
class MyFrame03 extends Frame{
窗口监听事件
package gui.lesson01.lesson03;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class TextFrameListener {
public static void main(String[] args) {
new MyFrame04();
}
}
class MyFrame04 extends Frame{
public MyFrame04() {
setBackground(Color.BLUE);
setBounds(100,100,300,300);
setVisible(true);
键盘监听事件
package gui.lesson01.lesson03;
import java.awt.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
public class TextKeyCode {
public static void main(String[] args) {
new MyFrame05();
}
}
class MyFrame05 extends Frame{
public MyFrame05() {
setBounds(1,2,300,400);
setVisible(true);
addKeyListener(new KeyAdapter() {