| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 593 人关注过本帖
标题:repaint( )
只看楼主 加入收藏
qingfeng101
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2008-11-27
收藏
 问题点数:0 回复次数:1 
repaint( )
//MouseEvents.java
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class MouseEvents extends Applet implements MouseListener
{
  String msg = "";
  int mouseX = 0, mouseY = 0;
  public void init() {
    addMouseListener(this);
  }
  public void mouseClicked(MouseEvent me)
  {
    mouseX = 0;
    mouseY = 10;
    msg = "鼠标被单击了";
    repaint();
  }
  public void mouseEntered(MouseEvent me)
  {
    mouseX = 0;
    mouseY = 10;
    msg = "鼠标进来了";
    repaint();
  }
  public void mouseExited(MouseEvent me)
  {
    mouseX = 0;
    mouseY = 10;
    msg = "鼠标被移走了";
    repaint();
  }
  public void mousePressed(MouseEvent me)
  {
    mouseX = me.getX();
    mouseY = me.getY();
    msg = "鼠标被按下了";
    repaint();
  }
  public void mouseReleased(MouseEvent me)
  {
    mouseX = me.getX();
    mouseY = me.getY();
    msg = "鼠标被放开了";
    repaint();
  }
  public void paint(Graphics g)
  {
    g.drawString(msg, mouseX, mouseY);
  }
  public static void main(String arg[])
  {
    MouseEvents A = new MouseEvents();
  }
}
请教一下repaint()是什么?
搜索更多相关主题的帖子: repaint 
2008-12-05 14:32
qingfeng101
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2008-11-27
收藏
得分:0 
回复 楼主 qingfeng101 的帖子
再多请教一下:讲解一下Applet类
2008-12-05 14:37
快速回复:repaint( )
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.066135 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved