import java.awt.event.*; import java.util.*; import java.awt.*; import java.applet.Applet; public class rendzu extends Applet implements MouseListener{ int asi=0; int[][] ruudud = new int[20][20]; public rendzu(){ addMouseListener(this); } public void paint (Graphics g){ for(int f=0; f<20; f++){ for(int d=0; d<20; d++){ g.drawRect(f*20+40,d*20+20,20,20); } } for (int f=0; f<20; f++){ for (int h=0; h<20; h++){ if (ruudud[h][f]==2){ g.fillOval(h*20+42,f*20+22,17,17); } if (ruudud[h][f]==1){ g.fillRect(h*20+42,f*20+22,17,17); } } } } public void mousePressed(MouseEvent e){ int x=((int)(e.getX()/20))-2; int y=((int)(e.getY()/20))-1; if(x>=0&&x<=19&&y>=0&&y<=19&&ruudud[x][y]!=1&&ruudud[x][y]!=2){ if(asi==0)ruudud[x][y]=1; else ruudud[x][y]=2; } asi++; if (asi>1)asi=0; paint(getGraphics()); } public void mouseReleased(MouseEvent e){} public void mouseClicked(MouseEvent e){} public void mouseEntered(MouseEvent e){} public void mouseExited(MouseEvent e){} public static void main(String Argumendid[]){ Frame f=new Frame("RENDZU THE BRAIN-WACKER"); f.setSize(480,460); f.setResizable(false); f.add(new rendzu()); f.setVisible(true); f.addWindowListener(new akenkinni()); } } class akenkinni extends WindowAdapter{ public void windowClosing(WindowEvent e){ System.exit(0); } }