小编sko*_*kol的帖子

初学者挥杆递归

第一次在这里发帖 这个编程任务让我难过,代码如下:

import java.awt.*;
import javax.swing.*;

public class HTree extends JPanel {

private Color color = new Color((int)(Math.random() * 256), (int)(Math.random() * 256), (int)(Math.random() * 256));

public void draw(Graphics g, int n, double sz, double x, double y) {
    if (n == 0) return; 
    double x0 = x - sz/2, x1 = x + sz/2;
    double y0 = y - sz/2, y1 = y + sz/2;
    // draw the 3 line segments of the H  
    g.setColor(color);
    g.drawLine((int)x0, (int)y, (int)x1, (int)y); …
Run Code Online (Sandbox Code Playgroud)

java recursion swing

3
推荐指数
1
解决办法
218
查看次数

标签 统计

java ×1

recursion ×1

swing ×1