J2ME Polish
J2ME Polish 2.4 Documentation
Enough Software

FilteredChoiceGroup

A FilteredChoiceGroup displays several items which can be selected depending on it's choice type (either Choice.EXCLUSIVE, Choice.MULTIPLE or Choice.IMPLICIT). It behaves like a normal ChoiceGroup but it will open up a FilteredList when the user wants to select different choices.

Design

A closed FilteredChoiceGroup
The above design has been realized with these CSS settings:

.from {
	padding: 3;
	padding-left: 5;
	padding-vertical: 1;
	include-label: true;
	layout: left | expand;
	/** style of the filter-textfield of a FilteredList/FilteredChoiceGroup */
	filter-style: filterTextFieldStyle;
	/** style of the popup screen for a FileredChoiceGroup */
	popup-style: filterPopupStyle;
	background {
		type: round-rect;
		color: silver;
	}
}

.from:hover {
	padding: 3;
	padding-left: 3;
	background {
		type: round-rect;
		color: white;
	}
	layout: left | expand;	
}

.filterTextFieldStyle {
	margin-left: 2;
	margin-right: 2;
	before: url( search.png );
	background {
		color: white;
		border-color: black;
	}
	layout: expand | left;
}

.filterPopupStyle {
	repaint-previous-screen: true;
	margin: 10;
	margin-bottom: 0;
	padding: 5;
	background-color: bgColor;
}

FilteredChoiceGroup CSS Attributes

Here's a list of all FilteredChoiceGroup specific design attributes:

Choice Item CSS Attributes

Use the following CSS attributes for the styles of FilteredChoiceGroup items:

Programming

You can use FilteredChoiceGroups like a javax.microedition.lcdui.ChoiceGroup with the exception that you can use the Choice.IMPLICIT mode and cannot use the Choice.POPUP mode:

//#style from
this.sender = new FilteredChoiceGroup( "from: ", "select sender...", Choice.MULTIPLE );
this.sender.addCommand(this.cmdChoose);
this.sender.setItemCommandListener( this );
for (int i = 0; i < SENDERS.length; i++) {
	String senderAddress = SENDERS[i];
	//#style senderOption
	this.sender.append( senderAddress, null );
}
form.append( this.sender );

Refer to the FilteredList documentation for learning how to deal with the commands added to a FilteredChoiceGroup.

JavaDoc

back to top