i–{“ú‚̉ۑèj
ƒAƒ“ƒP[ƒg’²¸
‘O‰ñ‚̉ۑè‚̉𓚗á‚P
import java.util.*; public class X_Panel{ private GuiPanel panel; private int n; public X_Panel(int n){ this.n = n; this.init(); } protected void init(){ this.panel = new GuiPanel(); Light light[] = new Light[this.n]; for(int i = 0; i < this.n; i++){ light[i] = new GuiLamp(i + 1); this.panel.add(light[i]); } // ----- X‚Ì“_“” ----- for(int i = 0; i < 5; i++){ light[6*i].on(); } for(int i = 0; i < 5; i++){ light[4*(i+1)].on(); } this.panel.paint(); } }
‘O‰ñ‚̉ۑè‚̉𓚗á‚Q
import java.util.*; public class X_Panel{ private GuiPanel panel; private int n; public X_Panel(int n){ this.n = n; this.init(); } protected void init(){ this.panel = new GuiPanel(); Light light[] = new Light[this.n]; for(int i = 0; i < this.n; i++){ light[i] = new GuiLamp(i + 1); this.panel.add(light[i]); } // ----- X‚Ì“_“” ----- for(int i = 0; i < this.n; i++){ if((light[i].getNumber() % 6) == 1){ light[i].on(); } } for(int i = 0; i < this.n; i++){ if((light[i].getNumber() % 5) == 0){ int ii = light[i].getNumber() - light[i].getNumber()/5; light[ii].on(); } } this.panel.paint(); } }