⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 moused.java

📁 java的事件处理之关于鼠标!
💻 JAVA
字号:
/*
// header - edit "Data/yourJavaAppletHeader" to customize
// contents - edit "EventHandlers/Java Applet/onCreate" to customize
*/
import java.awt.*;
import java.applet.Applet;
public class moused extends Applet
{
	int mouse_x,mouse_y;
	String s;
	public void init()
	{
		resize(300,300);
	}
	//public boolean handleEvent(Event evt)
	//{
		//return true;
	//}
	public boolean action(Event evt,Object o)
	{
	return true;
	}
	public boolean mouseDown(Event evt,int x,int y)
	{
		mouse_x=x;
		mouse_y=y;
		s="mouseDown:";
		repaint();
	return true;
	}
	public boolean mouseUp(Event evt,int x,int y)
	{
		mouse_x=x;
		mouse_y=y;
		s="mouseUp:";
		repaint();
		return true;
	}
	public boolean mouseEnter(Event evt,int x,int y)
	{
		mouse_x=100;
		mouse_y=100;
		s="mouseEnter:";
		
		repaint();
		return true;
	}
	public boolean mouseExit(Event evt,int x,int y)
	{
		mouse_x=50;
		mouse_y=50;
		s="mouseExit:";
		repaint();
		return true;
	}
	public boolean mouseDrag(Event evt,int x,int y)
	{
		mouse_x=x;
		mouse_y=y;
		s="mouseDrag:";
		repaint();
		return true;
	}
	//public boolean mouseMove(Event evt,int x,int y)
	//{
		//mouse_x=x;
		//mouse_y=y;
		//s="mouseMove:";
		//repaint();
		//return true;
	//}
  
	public void paint(Graphics g)
	{
		g.drawString(s, mouse_x, mouse_y);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -