如标题所示,我想在我的 Julia 套装中添加 2-3 种带阴影的颜色。但我不知道该怎么做。我知道如何添加 1 种颜色,我做到了。但我必须添加2-3。
import java.awt.Color;
import java.awt.Graphics;
import java.util.Random;
import javax.swing.JApplet;
public class ComplexTester extends JApplet {
Color c;
public void init() {
resize(600, 600);
}
public Color setC1() {
c = new Color(250, 250, 0);
return c;
}
public void paint(Graphics g) {
Random generator = new Random();
Complex c = new Complex(-0.123, 0.745);
Complex b = new Complex();
for (int k = 0; k < 600; k++)
for (int j = 0; j < 600; j++) {
Complex a = new Complex((k / 200.0) - 1.5,
(600 - j) / 200.0 - 1.5);
int i = 0;
b = a;
do {
b = b.kwadrat().dodaj(c);
i++;
if (b.moduł2().getX() > 2)
break;
} while (i < 30);
if (i == 30) {
g.setColor(setC2());
g.drawOval(k, j, 1, 1);
}
}
}
}
setColor() 方法只添加一种颜色。有没有添加少量颜色的方法?