org.inclou.Palette
Class CompleteForm

java.lang.Object
  extended byjavax.microedition.lcdui.Displayable
      extended byjavax.microedition.lcdui.Screen
          extended byjavax.microedition.lcdui.Form
              extended byorg.inclou.Palette.CompleteForm
All Implemented Interfaces:
CommandListener

public class CompleteForm
extends Form
implements CommandListener

This is a Form subclass which prompts user to select a color by introducing manually the R, G and B values in decimal format (they must be between 0 and 255) or by a palette. It uses RGBform and PaletteCanvas functionality by instantiating them and implementing PaletteChoser and RGBChoser interfaces. It also allows you to preselect a color. It communicates with a main application through the ChoserInterface interface. Note that this application does not implement ChoserInterface and therefore it does not handle the events generated by PaletteCanvas or RGBform. Moreover, if forces the ChoserInterface parameter in constructor to be the handler.

Version:
Version 1.0 of package org.inclou.Palette
This package is MIDP 1.0 compliant.
This package has been compiled under 1.4.2 JDK.
Author:
Joel Samper. This code is published in www.inclou.org/freeware where you will find more php/java libraries. Please refer to this web for use conditions and other documentation.
See Also:
MIDmultiSelector, ChoserInterface

Constructor Summary
CompleteForm(PaletteCanvas p, ChoserInterface ch, Display d)
          Creates a new instance of CompleteForm.
 
Method Summary
 void commandAction(Command c, Displayable d)
           
 void setSelected(int c)
          Preselects a color, generally before PaletteCanvas is shown by a main application.
 
Methods inherited from class javax.microedition.lcdui.Form
append, append, append, delete, deleteAll, get, getHeight, getWidth, insert, set, setItemStateListener, size
 
Methods inherited from class javax.microedition.lcdui.Displayable
addCommand, getTicker, getTitle, isShown, removeCommand, setCommandListener, setTicker, setTitle, sizeChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompleteForm

public CompleteForm(PaletteCanvas p,
                    ChoserInterface ch,
                    Display d)
Creates a new instance of CompleteForm. It forces internally ch parameter to be the event handler for PaletteCanvas and RGBform internal objects.

Parameters:
ch - An application implementing ChoserInterface interface for requesting action after selection is made.
d - Display object of this MIDlet appliaction (needed for displaying Alerts).
Method Detail

setSelected

public void setSelected(int c)
Preselects a color, generally before PaletteCanvas is shown by a main application. An application may wish to have a color preselected. Note that actually the MOST SIMILAR color is selected from the set of displayed colors in the palette. This will only take effect next time a selection mode is entered.

Parameters:
c - Color that is wanted to be preselected.

commandAction

public void commandAction(Command c,
                          Displayable d)
Specified by:
commandAction in interface CommandListener