public class wuhuan extends Applet{ private Color clr[]={Color.blue,Color.black,Color.red,Color.yellow, Color.green}; //clr[]存储颜色 private int[] x={100,136,172,118,154}; //x[]存储圆心的x坐标 private int[] y={60,60,60,91,91}; //y[]存储圆心的y坐标 private int[][] xy={{100,60},{136,60},{172,60},{118,91},{154,91}}; //存储圆心的坐标 private int r=20,d=40; public void paint(Graphics g) //画图方法 { Font font = new Font("楷体",Font.PLAIN,20); //文字字体、大小 g.setFont(font);
https://blog.csdn.net/uber001/article/details/51384551
package com.saiermeng;
import java.applet.Applet;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
public class wuhuan extends Applet{
private Color clr[]={Color.blue,Color.black,Color.red,Color.yellow,
Color.green}; //clr[]存储颜色
private int[] x={100,136,172,118,154}; //x[]存储圆心的x坐标
private int[] y={60,60,60,91,91}; //y[]存储圆心的y坐标
private int[][] xy={{100,60},{136,60},{172,60},{118,91},{154,91}}; //存储圆心的坐标
private int r=20,d=40;
public void paint(Graphics g) //画图方法
{
Font font = new Font("楷体",Font.PLAIN,20); //文字字体、大小
g.setFont(font);
for(int i=0;i<5;i++) //循环5次,画5个圆环
{
g.setColor(clr[i]);
g.drawOval(x[i], y[i], d, d); //d代表椭圆外切矩形的长宽,相等代表圆
}
g.setColor(Color.blue); //设置颜色
g.setFont(font);
g.drawString("奥运五环旗",120,169);
}
}
---------------------
作者:uber001
来源:CSDN
原文:https://blog.csdn.net/uber001/article/details/51384551
版权声明:本文为博主原创文章,转载请附上博文链接!
一周热门 更多>