java绘制哆啦绘制哆啦A梦梦 超可爱超可爱
主要介绍了java绘制哆啦A梦,特别的可爱,文中示例代码介绍的也非常详细,具有一定的参考价值,感兴趣的
小伙伴们可以参考一下
本文实例为大家分享了java绘制哆啦A梦的具体代码,供大家参考,具体内容如下
以下是画出哆啦a梦的代码
package com;
import javax.swing.*;
import java.awt.*;
public class dlam extends JFrame{
public dlam() {
this.setTitle("哆啦A梦");
this.setVisible(true);
this.setSize(370,460);
}
public void paint(Graphics graphics) {
super.paint(graphics);
graphics.setColor(Color.white);
graphics.fillRect(0, 0, 370, 450);
Color blue = new Color(0,100,255);
graphics.setColor(blue);
graphics.fillOval(65,60,240,230);
graphics.fillRect(109, 290, 150, 120);
int xValues[] = {109,70,63,109};
int yValues[] = {290, 278, 308, 321};
graphics.fillPolygon(xValues,yValues,4);
int xValues2[] = {259,305, 295, 259};
int yValues2[] = {290, 308, 332, 321};
graphics.fillPolygon(xValues2,yValues2,4);
graphics.setColor(Color.white);
graphics.fillOval(41,271,40,40);
graphics.fillOval(292, 305, 40, 40);
graphics.fillOval(73, 402, 20, 20);
graphics.fillOval(90, 405, 90, 25);
graphics.fillOval(186, 405, 90, 25);
graphics.setColor(Color.black);
graphics.drawOval(41,271,40,40);
graphics.drawOval(292, 305, 40, 40);
graphics.drawOval(90, 405, 90, 35);
graphics.drawOval(186, 405, 90, 35);