如何移动这个小程序?

时间:2016-04-02 15:36:48

标签: java applet jcreator

请帮我把这个applet移动。我想让这两只手臂摇摆不定。这段代码只显示了他的手臂,因为我不允许在这里发布所有代码。请帮帮我!谢谢大家!谢谢!这是我的代码:

import java.awt.*;
import javax.swing.*;
import java.applet.*;
import java.awt.geom.*;

public class Pucca extends Applet {

public Pucca(){
setSize(700, 700); }

//paint method
public void paint(Graphics g){



    g.setColor(Color.BLACK);
    g.drawArc(432, 350, 50, 50, 0, 180); //left arc line arm

    g.setColor(Color.BLACK);
    g.drawArc(911, 350, 50, 50, 0, 180); //right arc line arm

    g.drawLine(482, 375, 432, 375); // left down arm

    g.drawLine(962, 375, 912, 375); //right down arm

    g.setColor(yellow);
    g.fillRect(450, 375, 20, 180); //left yellow arm


    g.setColor(Color.BLACK);
    g.drawRect(450, 375, 20, 180); //left black arm line

    g.setColor(yellow);
    g.fillRect(928, 375, 20, 180); // right yellow arm

    g.setColor(Color.BLACK);
    g.drawRect(928, 375, 20, 180); //right black arm line


     g.setColor(yellow);
    g.fillOval(435, 530, 50, 50); //left cirle yellow oval

    g.setColor(Color.BLACK);
    g.drawOval(435, 530, 50, 50); //left circle hand line


    g.setColor(yellow);
    g.fillOval(915, 530, 50, 50); //right  circle yellow oval

    g.setColor(Color.BLACK);
    g.drawOval(915, 530, 50, 50); //right circle hand line

}
}

0 个答案:

没有答案