taiji.java~1~

来自「利用java中Graphics2D对象的fill方法编的一个有趣的太极图」· JAVA~1~ 代码 · 共 36 行

JAVA~1~
36
字号
/*
 * @(#)Taiji.java 1.0 05/03/19
 *
 * You can modify the template of this file in the
 * directory ..\JCreator\Templates\Template_2\Project_Name.java
 *
 * You can also create your own project template by making a new
 * folder in the directory ..\JCreator\Template\. Use the other
 * templates as examples.
 *
 */
import java.awt.*;
import java.applet.*;
import java.awt.geom.*;


public class Taiji extends Applet
{
	public void paint(Graphics g)
	{
		Graphics2D g1=(Graphics2D)g;
		g1.setColor(Color.cyan);
		Rectangle2D rect=new Rectangle2D.Double(0,0,200,200);
		g1.fill(rect);
		Arc2D a1=new Arc2D.Double(0,0,200,200,0,180,Arc2D.CHORD),
		a2=new Arc2D.Double(0,0,200,200,0,-180,Arc2D.CHORD);
		RoundRectangle2D r1=new RoundRectangle2D.Double(0,50,100,100,100,100);
		g1.setColor(Color.white);g1.fill(a1);
		g1.setColor(Color.black);g1.fill(a2);
		g1.fill(r1);
		
	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?