FileDocCategorySizeDatePackage
Color.javaAPI DocJ2ME MIDP 2.02904Thu Nov 07 12:02:16 GMT 2002example.chooser

Color

public class Color extends MIDlet implements CommandListener
A Color chooser MIDlet.

Fields Summary
private Display
display
This MIDlets Display object
private ColorChooser
chooser
The Color chooser
private Command
exitCommand
The Exit Command
private Command
decimalCommand
The Decimal Command
private Command
hexCommand
The Hexadecimal Command
private Command
coarseCommand
The Coarse command
private Command
fineCommand
The Fine command
private Command
aboutCommand
The Command to show the About box
Constructors Summary
public Color()
Construct a new Color MIDlet and initialize.


                
      
	display = Display.getDisplay(this);
	chooser = new ColorChooser(display.isColor(), display.numColors());
	
	chooser.addCommand(exitCommand);
	chooser.addCommand(hexCommand);
	chooser.addCommand(fineCommand);
	chooser.addCommand(aboutCommand);
	chooser.setCommandListener(this);

	chooser.setColor(0xffff00);
    
Methods Summary
public voidcommandAction(Command c, Displayable s)
Respond to a commands issued on any Screen.

param
c Command invoked
param
s Displayable on which the command was invoked

	if (c == exitCommand) {
	    destroyApp(true);
	    notifyDestroyed();
	} else if (c == decimalCommand) {
	    chooser.setRadix(10);
	    chooser.removeCommand(decimalCommand);
	    chooser.addCommand(hexCommand);
	} else if (c == hexCommand) {
	    chooser.setRadix(16);
	    chooser.removeCommand(hexCommand);
	    chooser.addCommand(decimalCommand);
	} else if (c == fineCommand) {
	    chooser.setDelta(4);
	    chooser.removeCommand(fineCommand);
	    chooser.addCommand(coarseCommand);
	} else if (c == coarseCommand) {
	    chooser.setDelta(32);
	    chooser.removeCommand(coarseCommand);
	    chooser.addCommand(fineCommand);
	} else if (c == aboutCommand) {
	    About.showAbout(display);
	} 
    
public voiddestroyApp(boolean unconditional)
Destroy must cleanup everything.

param
unconditional true if must destroy

    
public voidpauseApp()
Pause

    
public voidstartApp()
Create the ColorChooser and make it current

	display.setCurrent(chooser);