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

📄 mousedrag.java

📁 java练习程序
💻 JAVA
字号:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class MouseDrag extends Applet implements MouseMotionListener
{ 
	TextField text;
	public void init()
	{ 
		text=new TextField();
		setLayout(new BorderLayout());
		setBackground(Color.green);
		addMouseMotionListener(this); 
		add(text, "South");
	}
	
	public void mouseDragged(MouseEvent e)
	{
		text.setBackground(Color.red);
		text.setText("鼠标的坐标:"+"("+e.getX()+", "+e.getY()+")");
	}
	
	public void mouseMoved(MouseEvent e)
	{
		text.setBackground(Color.blue);
		text.setText("鼠标的坐标:"+"("+e.getX()+", "+e.getY()+")");
	}
}

⌨️ 快捷键说明

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