FileDocCategorySizeDatePackage
MixTest.javaAPI DocJ2ME MIDP 2.02346Thu Nov 07 12:02:20 GMT 2002example.audiodemo

MixTest

public class MixTest extends MIDlet implements CommandListener

Fields Summary
private static final String[]
mcases
static String
wavUrl
private static MixCanvas
soundObj
private Command
exitCommand
private Command
playCommand
private Display
display
private static List
theList
private static MixTest
instance
Constructors Summary
public MixTest()

	instance = this;
	display  = Display.getDisplay(this);
	theList  = new List("Lists", Choice.IMPLICIT);
	for (int i = 0; i < mcases.length; i++) {
	    theList.append(mcases[i], null);
	}
	wavUrl = getAppProperty("MixTestURL");
	theList.addCommand(playCommand);
	theList.addCommand(exitCommand);
	theList.setCommandListener(this);
    
Methods Summary
public voidcommandAction(Command c, Displayable s)


	if (c == exitCommand) {
	    destroyApp(false);
	    notifyDestroyed();
	} else if ((s == theList && c == List.SELECT_COMMAND) || c == playCommand) {
	    int i = theList.getSelectedIndex();
	    soundObj.setIndex(i);
	    display.setCurrent(soundObj);
            soundObj.serviceRepaints();
	    soundObj.playSound();
	}
    
public voiddestroyApp(boolean unconditional)
Destroy must cleanup everything not handled by the garbage collector.

	if ( soundObj != null )
	    soundObj.stopSound();
	soundObj = null;
    
public static example.audiodemo.MixTestgetInstance()

    
        
	return instance;
    
public static ListgetList()

	return theList;
    
public voidpauseApp()
Pause is a no-op since there are no background activities or record stores that need to be closed.

public voidstartApp()

	if (soundObj != null ) {
	    soundObj.stopSound();
	} else {
	    soundObj = new MixCanvas(display);
	}
	display.setCurrent(theList);