import java.applet.Applet; import java.awt.*; public class Male extends Applet{ Button[][] nupud=new Button[8][8]; int kx=7, ky=4; public void init(){ setLayout(new GridLayout(8, 8)); for(int str=0; str<8; str=str+1){ for(int stol=0; stol<8; stol++){ nupud[str][stol]=new Button(); add(nupud[str][stol]); if((stol%2==0 && str%2==0) || (stol%2!=0 && str%2!=0)) nupud[str][stol].setBackground(Color.white); else nupud[str][stol].setBackground(Color.black); if(str==2 && stol==0)nupud[str][stol].setLabel("C"); if(Math.abs(str-ky)+Math.abs(stol-kx)<=3){ nupud[str][stol].setLabel("o"); nupud[str][stol].setForeground(Color.blue); } if(str==4 && stol==7){ nupud[str][stol].setLabel("K"); nupud[str][stol].setForeground(Color.white); } } } } public void paint(Graphics ekraan){ ekraan.drawString("Tere", 30, 60); ekraan.setColor(Color.green); ekraan.drawRect(20, 50, 80, 30); } }