分析下列程序,写出其功能。 import java.applet.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; class MyPanel extends JPanel { public void print(int r){ Graphics g = getGraphics();//获得系统给予小应用程序的图形对象 g.clearRect(0,0, this.getWidth(),this.getHeight());//擦除矩形块 g.setColor(Color.red); g.fillOval(10, 10, r, r);//用红色填充一个圆块 } } class MyWindow14 extends JFrame implements MouseListener{ JTextArea text; MyPanel panel; int x, y, r=10; int mouseFlg = 0; static String mouseStates[] = {"鼠标键按下","鼠标松开","鼠标进来","鼠标走开","鼠标双击"}; MyWindow14(String s){ super(s); Container con = this.getContentPane(); con.setLayout(new GridLayout(2,1)); this.setSize(200, 300); this.setLocation(100, 100); panel = new MyPanel(); con.add(panel); text= new JTextArea(10,20); text.setBackground(Color.pink); con.add(text); addMouseListener(this); this.setVisible(true); this.pack(); } public void paint(Graphics g){ r = r+4; if(r > 80) r = 10; text.append(mouseStates[mouseFlg]+"了,位置是:"+x+","+y+"\n"); panel.print(r); } public void mousePressed(MouseEvent e){//按下 x = e.getX(); y = e.getY();mouseFlg = 0; repaint(); } public void mouseReleased(MouseEvent e){//松开 x = e.getX(); y = e.getY();mouseFlg = 1; repaint(); } public void mouseEntered(MouseEvent e){//进入 x = e.getX(); y = e.getY();mouseFlg = 2; repaint(); } public void mouseExited(MouseEvent e){//走开 x = e.getX(); y = e.getY();mouseFlg = 3; repaint(); } public void mouseClicked(MouseEvent e){//双击e.getClickCount()==2 if(e.getClickCount()==2){ x = e.getX(); y = e.getY();mouseFlg = 4; repaint(); }else {} } } public class Test extends Applet { public void init(){ MyWindow14 myWndow = new MyWindow14("鼠标事件示意程序"); } }