package jiqimao;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import javax.swing.JFrame;
public class GraphicsTester extends JFrame{
public GraphicsTester() {
super(“画图”); //设置模版大小
setVisible(true);
setSize(1000,800); //剩余可以话别的
}
public void paint(Graphics g) {
super.paint(g);
g.setColor(Color.BLUE);//多啦a梦
g.fillOval(670, 300, 200, 180);
g.setColor(Color.WHITE);
g.fillOval(688, 335, 165, 145);
g.setColor(Color.BLACK);
g.drawOval(670, 300,200, 180);
g.drawOval(688, 335, 165, 145);
g.drawOval(730, 310, 40, 45);//左眼
g.drawOval(768, 310, 40, 45);//右眼
g.drawOval(755, 350, 30, 30);
g.drawLine(769,440,769,380);//鼻子
g.drawArc(695, 310, 150, 150, 210, 120);//嘴
g.drawLine(775, 410, 835, 410);
g.drawLine(700,410, 763, 410);
g.drawLine(775, 400, 835, 385);
g.drawLine(775, 422, 835, 437);
g.drawLine(700, 435, 763, 420);
g.drawLine(700, 388, 763, 398);
g.setColor(Color.WHITE);
g.fillOval(730, 310, 40, 45);
g.fillOval(768, 310, 40, 45);
g.setColor(Color.BLACK);
g.drawArc(749, 327, 25, 50,45, 90);//右眼睛
g.drawArc(768, 325, 25, 55, 45, 90);//左眼睛
g.setColor(Color.RED);
g.fillOval(755, 350, 30, 30);
g.setColor(Color.WHITE);
g.fillOval(768, 360, 10, 10);
g.setColor(Color.BLUE);
g.fillRect(693, 475, 155, 165);
g.setColor(Color.WHITE);
g.fillOval(715, 485, 110, 120);
g.setColor(Color.RED);
g.fillRoundRect(689, 470, 165, 15, 30, 40);
g.setColor(Color.BLACK);
g.drawLine(740, 540, 795, 540);//兜直线
g.drawArc(740, 509, 55, 60, 182,175);//兜曲
g.setColor(Color.YELLOW);
g.fillOval(755, 480, 30, 30);
g.setColor(Color.BLACK);
g.drawOval(755, 480, 30, 30);
g.fillOval(765, 492, 10, 10);
g.drawLine(755, 490, 785,490);
g.drawLine(755, 485, 785, 485);
g.drawLine(770, 495, 770, 510);
g.drawLine(755, 620, 785, 620);
g.drawLine(770, 620, 770, 635);
g.setColor(Color.WHITE);
g.fillOval(785, 620, 80, 40);
g.fillOval(675, 620, 80, 40);
g.setColor(Color.BLUE);
int[] xs7= {657,693,693,657};
int[] xy7= {553,490,565,553};
g.fillPolygon(xs7, xy7, 4);
int[] xs8= {837,870,890,840};
int[] xy8= {485,461,484,530};
g.fillPolygon(xs8, xy8, 4);
g.setColor(Color.WHITE);
g.fillOval(650, 555, 40, 40);
g.fillOval(870,445,40,40);
g.setColor(Color.BLACK);
g.drawOval(650, 555, 40, 40);
g.drawOval(870, 445, 40, 40);
g.setFont(new Font(“宋体”,Font.BOLD,30)); //设置文字
g.drawString(“多啦A梦,不是梦”, 650, 200);
}
public static void main(String[] args) {
new GraphicsTester().setVisible(true);
}
}
楼主你好:我帮你整理了一下在电脑端发布,是支持代码语言格式发布的,你可以看看下面我回复的效果,建议涉及代码语言的分享,使用电脑发布,而且格式还很多,博科园官网:www.bokeyuan.net
同时将你的原分类从【学生圈】>【经验分享】改成【IT计算机科学】>【代码分享】啦
使用电脑端高级编辑器发出来的代码语言效果是这样的:
main方法。