Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

problem with doja?

gijsmangijsman Posts: 1Member
[b][red]This message was edited by gijsman at 2005-10-25 1:29:31[/red][/b][hr]
[b][red]This message was edited by gijsman at 2005-10-25 1:28:43[/red][/b][hr]
I've got a project for school, I have to make a Doja appli.
its a kind of tamagochi idea.

but its the first time for me I used Doja,

I want to make 5 buttons that will change a GIF animation,
it succeeded making one button, but not more, beceause de the actionlistener gets the same name.. Can anyone help me and explain me in simple words?

this is the source-code I have:


/*
* Written by Raber Sabir- November 2003-Hogeschool van Amsterdam
* Any comments? mail me at rabersabir@hotmail.com
*/

import com.nttdocomo.io.ConnectionException;
import com.nttdocomo.ui.*;
import com.nttdocomo.util.*;

public class Voorbeeld1 extends IApplication {
/* Maak een object van de class InlogScherm */
private InlogScherm inlogScherm;

public Voorbeeld1()
{
inlogScherm=new InlogScherm("Inlog Scherm");
}

public void start()
{
Display.setCurrent(inlogScherm);
}
}


class InlogScherm extends Panel implements ComponentListener
{

private MediaImage image1, image2;
private VisualPresenter plaatje;
private ImageLabel imageLabel, imageLabel2;
private Button eetKnopje, balKnopje, zelfmoordKnopje, doushenKnopje, slaapKnopje, terugKnopje;

public InlogScherm(String title)
{
setBackground(0xffffce);

try
{
image2 = MediaManager.getImage("resource:///knijn/gifs/kanormaal.gif");
image2.use();

image1 = MediaManager.getImage("resource:///knijn/gifs/kaeten.gif");
image1.use();

plaatje = new VisualPresenter();
plaatje.setImage(image2);

}
catch (Exception e)
{
System.out.println("Exception:" + e.getMessage());
}

eetKnopje=new Button("drink");
doushenKnopje=new Button("wassen");
zelfmoordKnopje=new Button("zelfmoord");
slaapKnopje=new Button("slapen");
balKnopje=new Button("bal");
terugKnopje=new Button("<<");
setComponentListener(this);

eetKnopje.setLocation(0,50);

add(plaatje);
plaatje.play();
add(eetKnopje);
add(terugKnopje);
}


public void componentAction(Component source,
int type, int param)
{
plaatje.stop();
plaatje.setImage(image1);
plaatje.play();

}

}




Sign In or Register to comment.