import java.awt.Color;
import java.awt.Frame;
import java.awt.Label;
import java.awt.Window;
public class Window_1 extends Frame {
Window[] win = new Window[20];
Color [] color = {Color.red, Color.yellow, Color.green};
public Window_1(String str)
{
super(str);
int x = 0;
int y = 0;
Window w = new Window(null);
w.setSize(100,100);
w.setBackground(Color.pink);
w.setVisible(true);
for (int i = 0; i < 20; i++) {
win[i] = new Window(this);
win[i].setBackground(color[i%3]);
Label lbl = new Label(i+"번 윈도우");
win[i].add(lbl);
if (i/10 == 0 || i/10 ==2 ) {
x += 10;
y += 10;
win[i].setBounds(150+x,150+y,100,100);
}
else{
x += 10;
y -= 10;
win[i].setBounds(150+x, 150+y ,100,100);
}
setVisible(false);
win[i].setVisible(true);
}
/*
* for (int i = 0; i < 10; i+=4) { win[i].setVisible(false); }
*/
setLocation(90,90);}
public static void main(String[] args) {
new Window_1("윈도우");
}
}
=====================================================
왜 이거 실행시키면 마지막 19번 win만 화면에 찍히는거야????
setVisible(false);
win[i].setVisible(true); <<<<<이거 위아래 줄 위치 바꾸면 19번 win 안나오는데 왜그런지 설명 가능하신분 있나요????
이제 클라우드의 시대