📄 moused.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 + -