|
Executo este Applet e ele executa o While do m�todo
Exibe uma unica vez, eu queria que ele executasse mais vezes.
import java.awt.*; import java.applet.*; public class Teste extends Applet
{ Label lblA = new Label("Animacao:"); Choice cboA = new Choice(); Font f1 = new
Font("Courier",Font.PLAIN,12);
public void
init()
{ setLayout(null); lblA.setFont(f1); add( lblA );
cboA.setFont(f1);
cboA.addItem("Homem-aranha"); cboA.addItem("Coelho"); add( cboA ); cboA.requestFocus();
lblA.reshape(1,0,70,20);
cboA.reshape(71,0,110,20); } public boolean action(Event
evt,Object arg)
{ if (evt.target instanceof Choice) { String d = cboA.getSelectedItem(); if (d.equals("Homem-aranha")) Exibe("a1",2); if (d.equals("Coelho")) Exibe("f1",8); return true; } return false; } public void Exibe(String a, int
b)
{ String arq1[] = {"aranha1.bmp", "aranha2.bmp"}; String arq2[] = {"coelho1.bmp", "coelho2.bmp", "coelho3.bmp", "coelho4.bmp", "coelho5.bmp", "coelho6.bmp", "coelho7.bmp", "coelho8.bmp",}; Image
img1;
Graphics g = getGraphics(); int ct = 0; int i = 0; int bc = 0; while
(ct < (b * 3))
{ if (a.equals("a1")) { img1 = getImage(getCodeBase(),arq1[bc]); g.drawImage(img1,1,30,this); ct=ct + 1; } if
(a.equals("f1"))
{ img1 = getImage(getCodeBase(),arq2[bc]); g.drawImage(img1,1,30,this); ct=ct + 1; } bc = bc +
1;
if (bc > b) bc=1; try { Thread.sleep(500); } catch (InterruptedException e) { } } } }
|
- [java-list] Re: Anima��o - S� funciona uma vez luizbarbosa
- [java-list] Re: Anima��o - S� funciona uma vez Robert Mauro Lang
- [java-list] RE: Anima��o - S� funciona uma vez Rafael Casagrande
