所以这是我并排制作一堆表格的代码。(我还是个初学者)
import java.applet.Applet;
import java.awt.*;
public class Test extends Applet{
public void init() {
setSize(500, 225);
}
public void paint (Graphics g){
//Desk #1
int [ ] x8 = {430, 430, 351, 351};
int [ ] y8 = {200, 185, 185,200};
g.drawPolygon(x8, y8, 4);
//Desk #2
int [ ] x9 = {351, 351, 272, 272};
int [ ] y9 = {200, 185, 185, 200};
g.drawPolygon(x9, y9, 4);
//Desk #3
int [ ] x10 = {272, 272, 193, 193};
int [ ] y10 = {185, 200, 200, 185};
g.drawPolygon(x10, y10, 4);
//Desk #4
int [ ] x11 = {193, 193, 114, 114};
int [ ] y11 = {185, 200, 200, 185};
g.drawPolygon(x11, y11, 4);
//Desk #5
int [ ] x12 = {114, 114, 35, 35};
int [ ] y12 = {185, 200, 200, 185};
g.drawPolygon(x12, y12, 4);
}
}
我想要做的只是做一个while循环,所以我不需要做所有这些序列垃圾,有人可以为我制作一个有效的while循环代码并教我他们是如何做到的,我'长期以来一直坚持这一点。