📄 cursor.java~12~
字号:
package approach;import java.awt.*;import java.awt.event.*;import java.applet.*;public class cursor extends Applet { int x,y; int x1=0,y1=0; boolean isStandalone = false; /**Get a parameter value*/ public String getParameter(String key, String def) { return isStandalone ? System.getProperty(key, def) : (getParameter(key) != null ? getParameter(key) : def); } /**Construct the applet*/ public cursor() { } /**Initialize the applet*/ public void init() { try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } /**Component initialization*/ private void jbInit() throws Exception { this.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseMoved(MouseEvent e) { this_mouseMoved(e); } }); } /**Get Applet information*/ public String getAppletInfo() { return "Applet Information"; } /**Get parameter info*/ public String[][] getParameterInfo() { return null; } void this_mouseMoved(MouseEvent e) { x = e.getX() ; y = e.getY() ; repaint(); } public void run(){ while(true){ try{ if (x1<x) x1++; else x1--; if (y1<y) y1++; else y1--; repaint(); Thread.sleep(100); } catch(InterruptedException e){} } } public void paint(Graphics g){ g.setColor(Color.yellow); g.fillRoundRect(x1,y1,30,30,5,5); g.drawString("JAVA",x1,y1); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -