import java.applet.Applet; import java.awt.event.*; import java.awt.*; public class test1 extends Applet { PlayCanvas P; ViewCanvas V; Canvas X; Canvas T; GridBagLayout game; GridBagConstraints c; int[] PIECE=new int[10]; double[] SIZE=new double[10]; Color[] COLOR=new Color[30]; Color[]VCOLOR=new Color[50]; double[] VSIZE=new double[10]; public void init() { PIECE[0]=2; PIECE[1]=1; PIECE[2]=2; PIECE[3]=5; SIZE[0]=780; SIZE[1]=190; SIZE[2]=0; SIZE[3]=30; VSIZE[0]=110; VSIZE[1]=100; VSIZE[2]=20; VCOLOR[0]=Color.red; VCOLOR[1]=Color.blue; VCOLOR[2]=Color.cyan; VCOLOR[3]=Color.yellow; VCOLOR[10]=Color.black; VCOLOR[11]=new Color(220,220,220); VCOLOR[12]=Color.blue; VCOLOR[13]=new Color(10,70,120); VCOLOR[20]=Color.white; VCOLOR[21]=Color.black; VCOLOR[22]=Color.white; VCOLOR[23]=Color.white; VCOLOR[30]=new Color(80,80,80); VCOLOR[31]=Color.white; VCOLOR[32]=Color.blue.darker(); VCOLOR[33]=new Color(20,90,160); COLOR[0]=Color.blue.brighter(); COLOR[1]=Color.blue.darker(); COLOR[2]=Color.red.brighter(); COLOR[3]=Color.red.darker(); COLOR[4]=Color.green.brighter(); COLOR[5]=Color.green.darker(); COLOR[6]=Color.magenta; COLOR[7]=Color.magenta.darker(); COLOR[8]=Color.cyan; COLOR[9]=Color.cyan.darker(); COLOR[10]=Color.yellow; COLOR[11]=Color.yellow.darker(); COLOR[12]=new Color(100,100,255); COLOR[13]=new Color(100,50,50); game=new GridBagLayout(); c=new GridBagConstraints(); setLayout(game); P=new PlayCanvas(SIZE,PIECE,COLOR); V=new ViewCanvas(VSIZE,VCOLOR,P); X=new Canvas(); X.setSize(10,10); P=P.addView(V); P.setBackground(Color.black); V.setBackground(Color.black); setBackground(Color.blue); add(V); add(X); add(P); } } class DBCanvas extends Canvas { public void update(Graphics g) { Graphics g2; Image offscreen = null; offscreen = createImage(getSize().width, getSize().height); g2 = offscreen.getGraphics(); paint(g2); g.drawImage(offscreen, 0, 0, this); g2.dispose(); offscreen.flush(); } } class PlayCanvas extends DBCanvas implements MouseListener,MouseMotionListener { PolyFlip[] P=new PolyFlip[10]; Complex[] z=new Complex[10]; double SIZE[]; int PIECE[]; Color COLOR[]; int listen; ViewCanvas V; int AXIS; int history; int shadow; PlayCanvas(double[] SIZE,int[] PIECE, Color[] COLOR) { addMouseListener(this); addMouseMotionListener(this); this.SIZE=SIZE; this.PIECE=PIECE; this.COLOR=COLOR; int side=PIECE[PIECE[0]+1]; int i; for(i=1;i<10;++i) { z[i]=new Complex(); z[i]=z[i].ZERO(); } for(i=1;i<=PIECE[0];++i) { P[i]=new PolyFlip(SIZE[2],SIZE[3],PIECE[i],side,z[i],0,0,0,COLOR); } listen=-1; history=-5; shadow=-1; AXIS=0; this.setSize((int)(SIZE[0]),(int)(SIZE[0])); reconfigure(7); } public void paint(Graphics gfx) { Graphics2D g=(Graphics2D) gfx; g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); int i; int x,y; x=(int)(V.MOVE.x*SIZE[1]/V.SIZE[2]); y=(int)(V.MOVE.y*SIZE[1]/V.SIZE[2]); g.setColor(V.COLOR[20+V.BACK]); g.drawRect(0,0,2*(int)(SIZE[1])-1,2*(int)(SIZE[1])-1); g.translate((int)(SIZE[1]),(int)(SIZE[1])); g.translate(-x,-y); /*markers*/ if((AXIS==0)||(AXIS==2)) P[1].goal_render(g,V.COLOR[30+V.BACK]); if((AXIS==1)||(AXIS==2)) { g.setColor(V.COLOR[20+V.BACK]); g.drawLine(-2000,0,2000,0); g.drawLine(0,-2000,0,2000); } /*****************/ /*pieces*/ if((shadow>-1)&&(V.shadow_option==1)) { for(i=1;i<=PIECE[0];++i) this.P[i].shadow_render(g,shadow,V.COLOR[20+V.BACK]); } for(i=1;i<=PIECE[0];++i) this.P[PIECE[0]+1-i].render(g,V.COLOR[20+V.BACK]); /********/ g.setColor(V.COLOR[20+V.BACK]); g.translate(-(int)(SIZE[1]),-(int)(SIZE[1])); g.translate(x,y); g.drawRect(0,0,2*(int)(SIZE[1])-1,2*(int)(SIZE[1])-1); g.setColor(Color.blue); g.fillRect((int)(2*SIZE[1]),0,(int)(SIZE[0]-2*SIZE[1]),(int)(SIZE[0])); g.fillRect(0,(int)(2*SIZE[1]),(int)(SIZE[0]),(int)(SIZE[0]-2*SIZE[1])); } public void mouseDragged(MouseEvent e) {} public void mousePressed(MouseEvent e) {} public void mouseEntered(MouseEvent e) { history=-3;} public void mouseExited(MouseEvent e) { shadow=-1; repaint(0,0,(int)(2*SIZE[1]),(int)(2*SIZE[1])); } public void mouseReleased(MouseEvent e) { shadow=-1; if(listen>-1) repaint(0,0,(int)(2*SIZE[1]),(int)(2*SIZE[1])); } public void mouseClicked(MouseEvent e) { int i; e.consume(); Point p=new Point(); int x=(int)(V.MOVE.x*SIZE[1]/V.SIZE[2]); int y=(int)(V.MOVE.y*SIZE[1]/V.SIZE[2]); p.x=x+e.getX()-(int)(SIZE[1]); p.y=y+e.getY()-(int)(SIZE[1]); this.listen=this.P[1].inside(p); for(i=2;i<=PIECE[0];++i) { if(this.listen==-1) this.listen=this.P[i].inside(p); } p.x=e.getX()-(int)(SIZE[1]); p.y=e.getY()-(int)(SIZE[1]); if((p.x>SIZE[1])||(p.y>SIZE[1])) listen=-1; for(i=1;i<=PIECE[0];++i) this.P[i]=this.P[i].flip(this.listen); if(listen>=0) { repaint(0,0,(int)(2*SIZE[1]),(int)(2*SIZE[1])); V.repaint(2,2,(int)(2*V.SIZE[1]-4),(int)(2*V.SIZE[1]-4)); } } public void mouseMoved(MouseEvent e) { int i; e.consume(); Point p=new Point(); int x=(int)(V.MOVE.x*SIZE[1]/V.SIZE[2]); int y=(int)(V.MOVE.y*SIZE[1]/V.SIZE[2]); p.x=x+e.getX()-(int)(SIZE[1]); p.y=y+e.getY()-(int)(SIZE[1]); if(V.shadow_option==1) { this.listen=this.P[1].inside(p); for(i=2;i<=PIECE[0];++i) { if(this.listen==-1) this.listen=this.P[i].inside(p); } p.x=e.getX()-(int)(SIZE[1]); p.y=e.getY()-(int)(SIZE[1]); if((p.x>SIZE[1])||(p.y>SIZE[1])) listen=-1; if(listen!=history) { shadow=listen; history=listen; repaint(1,1,(int)(2*SIZE[1]-2),(int)(2*SIZE[1]-2)); } } } PlayCanvas addView(ViewCanvas Y) { PlayCanvas X=this; X.V=Y; return(X); } PlayCanvas reconfigure(int side) { PlayCanvas Q=this; if(side==5) { Q.PIECE[0]=2; Q.PIECE[1]=1; Q.PIECE[2]=2; Q.PIECE[3]=5; } if(side==6) { Q.PIECE[0]=1; Q.PIECE[1]=1; Q.PIECE[2]=6; } if(side==7) { Q.PIECE[0]=3; Q.PIECE[1]=1; Q.PIECE[2]=2; Q.PIECE[3]=3; Q.PIECE[4]=7; } if(side==8) { Q.PIECE[0]=2; Q.PIECE[1]=1; Q.PIECE[2]=3; Q.PIECE[3]=8; } if(side==9) { Q.PIECE[0]=3; Q.PIECE[1]=1; Q.PIECE[2]=2; Q.PIECE[3]=4; Q.PIECE[4]=9; } if(side==10) { Q.PIECE[0]=2; Q.PIECE[1]=1; Q.PIECE[2]=3; Q.PIECE[3]=10; } if(side==11) { Q.PIECE[0]=5; Q.PIECE[1]=1; Q.PIECE[2]=2; Q.PIECE[3]=3; Q.PIECE[4]=4; Q.PIECE[5]=5; Q.PIECE[6]=11; } if(side==12) { Q.PIECE[0]=2; Q.PIECE[1]=1; Q.PIECE[2]=5; Q.PIECE[3]=12; } if(side==13) { Q.PIECE[0]=6; Q.PIECE[1]=1; Q.PIECE[2]=2; Q.PIECE[3]=3; Q.PIECE[4]=4; Q.PIECE[5]=5; Q.PIECE[6]=6; Q.PIECE[7]=13; } SIZE[2]=Q.P[1].r1; SIZE[3]=Q.P[1].r2; int i; for(i=1;i<=Q.PIECE[0];++i) { Q.P[i]=new PolyFlip(SIZE[2],SIZE[3],PIECE[i],side,Q.z[i].ZERO(),0,0,0,COLOR); } return(Q); } } class ViewCanvas extends DBCanvas implements MouseListener,MouseMotionListener { double SIZE[]; Color COLOR[]; PlayCanvas P; int listen; int BACK; Point MOVE=new Point(); int words; int history; int shadow_option; String[] S; ViewCanvas(double[] SIZE,Color COLOR[],PlayCanvas P) { this.SIZE=SIZE; this.COLOR=COLOR; this.P=P; addMouseListener(this); addMouseMotionListener(this); this.setSize((int)(2*SIZE[1]+SIZE[1]/5),(int)(P.SIZE[0])); setBackground(Color.black); listen=-1; BACK=0; MOVE.x=0; MOVE.y=0; S=new String[5]; S[1]="Move the cursor over any part of"; S[2]="the control panel and you can read"; S[3]="here how that part functions"; words=1; history=-4; shadow_option=1; } public void paint(Graphics gfx) { Graphics2D g=(Graphics2D) gfx; g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); int i; int[] s=new int[11]; s[1]=(int)(SIZE[1]); s[2]=(int)(SIZE[1]/5); s[3]=(int)(SIZE[2]); s[4]=(int)(s[2]/2); s[5]=(int)(s[2]/4); g.setColor(Color.blue); g.fillRect(0,2*s[1]+s[2],(int)(P.SIZE[0]),(int)(P.SIZE[0])); /*wordbox*/ g.fillRect(0,2*s[1]+s[2]+5,2*s[1]+s[2]-6,3*s[2]); g.setColor(Color.white); g.setFont(new Font("Helvetica",Font.PLAIN,12)); g.drawString(S[1],15,2*s[1]+s[2]+30); g.drawString(S[2],15,2*s[1]+s[2]+45); g.drawString(S[3],15,2*s[1]+s[2]+60); /**********/ /*title*/ g.setColor(Color.yellow); g.fillRect(0,3*s[1],2*s[1]+s[2]-1,4*s[2]); g.setColor(Color.orange); g.fillRect(0,3*s[1]+2*s[2],2*s[1]+s[2]-1,2*s[2]); g.setColor(Color.black); g.drawRect(0,3*s[1],2*s[1]+s[2]-1,4*s[2]); g.setFont(new Font("Helvetica",Font.PLAIN,25)); g.setColor(Color.black); g.drawString("Lucy and Lily II",10,3*s[1]+30); g.setFont(new Font("Helvetica",Font.PLAIN,12)); g.drawString("c 2000 Rich Schwartz",37,3*s[1]+67); g.drawOval(35,3*s[1]+57,12,12); /**********/ g.setColor(COLOR[20+BACK]); if(P.AXIS!=3) g.drawOval(s[1]-1,s[1]-1,2,2); g.translate((int)(SIZE[1]),(int)(SIZE[1])); g.translate(MOVE.x,MOVE.y); g.setColor(COLOR[BACK]); g.drawRect(-s[3],-s[3],2*s[3],2*s[3]); g.translate(-MOVE.x,-MOVE.y); for(i=1;i<=this.P.PIECE[0];++i) { g.setColor(COLOR[20+BACK]); int x=(int)(P.P[i].c.x*SIZE[2]/P.SIZE[1]); int y=(int)(P.P[i].c.y*SIZE[2]/P.SIZE[1]); if(P.P[i].hide==0) g.drawOval(x-2,y-2,4,4); } g.translate(-(int)(SIZE[1]),-(int)(SIZE[1])); /*buttons*/ g.setColor(Color.cyan.darker()); g.fillRect(0,2*s[1],2*s[1],s[2]); g.setColor(Color.yellow); g.fillRect(2*s[1],0,s[2]-1,2*s[1]); g.setColor(Color.yellow); for(i=0;i<=4;++i) g.fillRect(i*s[2],2*s[1],s[2],s[2]); g.setColor(Color.cyan); for(i=4;i<=3+P.PIECE[0];++i) g.fillRect(i*s[2],2*s[1],s[2],s[2]); g.setColor(Color.black); for(i=0;i<=3+P.PIECE[0];++i) g.drawRect(i*s[2],2*s[1],s[2],s[2]); g.setColor(Color.cyan); g.fillRect(2*s[1],0,s[2],3*s[2]); g.setColor(Color.green.brighter()); g.fillRect(2*s[1],3*s[2],s[2],4*s[2]); g.setColor(Color.yellow); g.fillRect(2*s[1],9*s[2],s[2],2*s[2]); g.setColor(Color.black); for(i=0;i<=10;++i) g.drawRect(2*s[1],i*s[2],s[2],s[2]); g.setColor(COLOR[20+BACK]); g.drawRect(0,0,2*s[1],2*s[1]); g.setColor(Color.black); g.drawRect(0,2*s[1],2*s[1]+s[2],s[2]-1); g.drawRect(2*s[1],0,s[2]-1,2*s[1]+s[2]); /**************/ /*button icons*/ g.setColor(Color.black); for(i=1;i<=P.PIECE[0];++i) { if(P.P[i].hide==0) g.drawOval((3+i)*s[2]+s[4]-2,2*s[1]+s[4]-2,4,4); } /*************/ g.drawOval(s[5],2*s[1]+s[5],s[4],s[4]); /***************/ g.drawLine(s[2]+s[5],2*s[1]+s[5],s[2]+s[5],2*s[1]+s[4]); g.drawLine(s[2]+s[5],2*s[1]+s[5],s[2]+s[4],2*s[1]+s[5]); g.drawLine(s[2]+s[5],2*s[1]+s[5],s[2]+s[4],2*s[1]+s[4]); /*******************/ g.drawLine(2*s[2]+s[4],2*s[1]+s[4],2*s[2]+s[5],2*s[1]+s[4]); g.drawLine(2*s[2]+s[4],2*s[1]+s[4],2*s[2]+s[4],2*s[1]+s[5]); g.drawLine(2*s[2]+s[5],2*s[1]+s[5],2*s[2]+s[4],2*s[1]+s[4]); /********************/ g.drawString("1",4+2*s[1],4*s[3]-s[5]); g.drawString("5",4+2*s[1],4*s[3]-s[5]+s[3]); g.drawString("20",2+2*s[1],4*s[3]-s[5]+2*s[3]); g.drawString("50",2+2*s[1],4*s[3]-s[5]+3*s[3]); g.translate(3*s[2],2*s[1]); g.fillRect(s[5],+s[5]-2,s[4],s[5]+2); g.drawRect(s[5],+s[5]-2,s[4],s[4]+3); g.translate(-3*s[2],-2*s[1]); /****************/ g.drawLine(2*s[1]+s[5],s[4]+2,2*s[1]+s[5]+s[4],s[4]+2); g.drawLine(2*s[1]+s[5],s[4]-2,2*s[1]+s[5]+s[4],s[4]-2); /****************/ g.drawLine(2*s[1]+s[4],s[2]+s[5],2*s[1]+s[4],s[2]+s[4]+s[5]); g.drawLine(2*s[1]+s[5],s[2]+s[4],2*s[1]+s[5]+s[4],s[2]+s[4]); /****************/ g.drawLine(2*s[1]+s[5],2*s[2]+s[4],2*s[1]+s[5]+s[4],2*s[2]+s[4]); /***************/ g.translate(2*s[1],7*s[2]); g.drawLine(s[5],s[4],s[5]+s[4],s[4]); g.drawLine(s[4],s[5],s[4],s[5]+s[4]); g.drawOval(s[4]-2,s[4]-2,4,4); g.translate(-2*s[1],-7*s[2]); g.translate(2*s[1],8*s[2]); g.setColor(COLOR[10+BACK]); g.fillRect(s[5],s[5],s[4],s[4]); g.setColor(Color.black); g.drawRect(s[5],s[5],s[4],s[4]); g.translate(-2*s[1],-8*s[2]); /****************/ g.drawRect(2*s[1]+s[5]-2,-s[2]+2*s[1]+s[5]-2,s[4]+4,s[4]+4); g.drawLine(2*s[1]+s[4],-s[2]+2*s[1]+s[4],2*s[1]+s[4]+s[5]-1,-s[2]+2*s[1]+s[4]+s[5]-1); g.drawLine(2*s[1]+s[4],-s[2]+2*s[1]+s[4],2*s[1]+s[4],-s[2]+2*s[1]+s[4]+s[5]-1); g.drawLine(2*s[1]+s[4],-s[2]+2*s[1]+s[4],2*s[1]+s[4]+s[5]-1,-s[2]+2*s[1]+s[4]); /****************/ g.translate(2*s[1],10*s[2]); g.drawRect(s[5]-2,s[5]-2,s[4]+4,s[4]+4); g.drawLine(s[4],s[4],s[4]+s[5]-1,s[4]+s[5]-1); g.drawLine(s[4],s[4]+s[5]-1,s[4]+s[5]-1,s[4]+s[5]-1); g.drawLine(s[4]+s[5]-1,s[4],+s[4]+s[5]-1,s[4]+s[5]-1); g.translate(-2*s[1],-10*s[2]); } public void mouseDragged(MouseEvent e) {} public void mouseReleased(MouseEvent e) {} public void mousePressed(MouseEvent e) {} public void mouseEntered(MouseEvent e) {} public void mouseClicked(MouseEvent e) { e.consume(); Point p=new Point(); p.x=e.getX(); p.y=e.getY(); int listen=0; int i,sid; sid=P.PIECE[P.PIECE[0]+1]; for(i=0;i<10;++i) { if((p.y>2*SIZE[1])&&(p.x>i*SIZE[1]/5)&&(p.x<=(i+1)*SIZE[1]/5)) listen=i+1; } for(i=0;i<11;++i) { if((p.x>2*SIZE[1])&&(p.y>i*SIZE[1]/5)&&(p.y<=(i+1)*SIZE[1]/5)) listen=i+11; } if(p.y>2.2*SIZE[1]) listen=-1; p.x=e.getX()-(int)(SIZE[1]); p.y=e.getY()-(int)(SIZE[1]); if(listen==0) { MOVE=p; repaint(2,2,(int)(2*SIZE[1]-2),(int)(2*SIZE[1]-2)); P.repaint(0,0,(int)(2*P.SIZE[1]),(int)(2*P.SIZE[1]));} if(listen==1) { for(i=1;i<=P.PIECE[0];++i) P.P[i]=P.P[i].ring(); P.repaint(0,0,(int)(2*P.SIZE[1]),(int)(2*P.SIZE[1])); } if(listen==2) { for(i=1;i<=P.PIECE[0];++i) P.P[i]=P.P[i].scale(1.0/0.9); repaint(2,2,(int)(2*SIZE[1]-2),(int)(2*SIZE[1]-2)); P.repaint(0,0,(int)(2*P.SIZE[1]),(int)(2*P.SIZE[1])); } if(listen==3) { for(i=1;i<=P.PIECE[0];++i) P.P[i]=P.P[i].scale(0.9); P.repaint(0,0,(int)(2*P.SIZE[1]),(int)(2*P.SIZE[1])); repaint(2,2,(int)(2*SIZE[1]-2),(int)(2*SIZE[1]-2)); } if(listen==4) { int m; int j,k; shadow_option=1-shadow_option; } if((listen>=5)&&(listen<5+P.PIECE[0])) { P.P[listen-4]=P.P[listen-4].hide(); P.repaint(0,0,(int)(2*P.SIZE[1]),(int)(2*P.SIZE[1])); repaint(2,2,(int)(2*SIZE[1]-2),(int)(2.2*SIZE[1]-2)); } if(listen==11) { P=P.reconfigure(sid); MOVE.x=0; MOVE.y=0; repaint(2,2,(int)(2.2*SIZE[1]-2),(int)(2.2*SIZE[1]-2)); P.repaint(0,0,(int)(2*P.SIZE[1]),(int)(2*P.SIZE[1])); } if(listen==12) { if(sid<13) { P=P.reconfigure(sid+1); MOVE.x=0; MOVE.y=0; repaint(2,2,(int)(2.2*SIZE[1]-2),(int)(2.2*SIZE[1]-2)); P.repaint(0,0,(int)(2*P.SIZE[1]),(int)(2*P.SIZE[1])); } } if(listen==13) { if(sid>5) { P=P.reconfigure(sid-1); MOVE.x=0; MOVE.y=0; repaint(2,2,(int)(2.2*SIZE[1]-2),(int)(2.2*SIZE[1]-2)); P.repaint(0,0,(int)(2*P.SIZE[1]),(int)(2*P.SIZE[1])); } } if(listen==14) { int m; int j,k; for(k=1;k<=1;++k) { m=P.P[1].random_integer(); for(j=1;j<=P.PIECE[0];++j) P.P[j]=P.P[j].flip(m); P.repaint(0,0,(int)(2*P.SIZE[1]+21),(int)(2*P.SIZE[1]+21)); repaint(2,2,(int)(2*SIZE[1]-2),(int)(2*SIZE[1]-2)); } } if(listen==15) { int m; int j,k; for(k=1;k<=5;++k) { m=P.P[1].random_integer(); for(j=1;j<=P.PIECE[0];++j) P.P[j]=P.P[j].flip(m); P.repaint(0,0,(int)(2*P.SIZE[1]+21),(int)(2*P.SIZE[1]+21)); repaint(2,2,(int)(2*SIZE[1]-2),(int)(2*SIZE[1]-2)); } } if(listen==16) { int m; int j,k; for(k=1;k<=20;++k) { m=P.P[1].random_integer(); for(j=1;j<=P.PIECE[0];++j) P.P[j]=P.P[j].flip(m); P.repaint(0,0,(int)(2*P.SIZE[1]+21),(int)(2*P.SIZE[1]+21)); repaint(2,2,(int)(2*SIZE[1]-2),(int)(2*SIZE[1]-2)); } } if(listen==17) { int m; int j,k; for(k=1;k<=50;++k) { m=P.P[1].random_integer(); for(j=1;j<=P.PIECE[0];++j) P.P[j]=P.P[j].flip(m); P.repaint(0,0,(int)(2*P.SIZE[1]+21),(int)(2*P.SIZE[1]+21)); repaint(2,2,(int)(2*SIZE[1]-2),(int)(2*SIZE[1]-2)); } } if(listen==18) { P.AXIS=P.AXIS+1; if(P.AXIS==4) P.AXIS=0; P.repaint(0,0,(int)(2*P.SIZE[1]),(int)(2*P.SIZE[1])); repaint(2,2,(int)(2*SIZE[1]-2),(int)(2*SIZE[1]-2)); } if(listen==19) { ++BACK; if(BACK==4)BACK=0; setBackground(COLOR[10+BACK]); P.setBackground(COLOR[10+BACK]); P.repaint(0,0,(int)(2*P.SIZE[1]),(int)(2*P.SIZE[1])); repaint(2,2,(int)(2*SIZE[1]-2),(int)(2*SIZE[1]-2)); } if(listen==20) { if(P.SIZE[1]>SIZE[1]+11) { P.SIZE[1]=P.SIZE[1]-20; P.repaint(0,0,(int)(2*P.SIZE[1]+41),(int)(2*P.SIZE[1]+41)); repaint(2,2,(int)(2*SIZE[1]-2),(int)(2*SIZE[1]-2)); } } if(listen==21) { if(P.SIZE[1]