📄 mov.java~24~
字号:
package moving;import java.awt.*;import java.awt.event.*;import java.applet.*;class Mov extends Thread{ public void run(){ while(true) { repaint(); try{mythread.sleep(40);} catch(InterruptedException e){} }}}public class mov extends Applet { public int i=0; public boolean flag=true; Font myfont=new Font("timsroman",Font.BOLD ,30); Color mycolor=new Color(255,255,0); Mov mythread=new MyThread(); 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); } public void start(){ mythread.start(); } public void stop(){ mythread.stop(); } public void paint(Graphics g) {if (flag==true) i++; else i--; if (i==280) flag=false; if (i==0) flag=true; g.setColor(mycolor); g.setFont(myfont); g.drawString("world",i,i); } /**Construct the applet*/ public mov() { } /**Initialize the applet*/ public void init() { try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } /**Component initialization*/ private void jbInit() throws Exception { } /**Get Applet information*/ public String getAppletInfo() { return "Applet Information"; } /**Get parameter info*/ public String[][] getParameterInfo() { return null; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -