J2ME Polish
J2ME Polish 2.4 Documentation
Enough Software


Container can hold many items Container contain different items. They are the basis for all J2ME Polish screens like Form, FramedForm or List.
You can create arbitrary complex items by nesting containers into each other.
You can also use columns and rows for containers or use any of the view-types available for Containers.


The following containers require an item source. An de.enough.polish.ui.ItemSource is responsible for translating underlying data into UI items. When an ItemSource is used, an de.enough.polish.ui.ItemConsumer will register with the source, so that the ItemSource can inform the ItemConsumer when the underlying data has been updated.

Using a Different Container

If you want to use a different container you can either use one of the provided convenience forms such as UniformForm or SourcedForm or you register the container as a root container using Screen.setRootContainer(Container):

public class MyFramedForm extends FramedForm
	public MyFramedForm()
		ItemSource mySource = new MyItemSource();
		SourcedLazyContainer container = new SourcedLazyContainer(mySource, 5, 15);


A de.enough.polish.ui.SourcedContainer is a normal container that uses an ItemSource.


The de.enough.polish.ui.SourcedLazyContainer only loads items when they are required. In contrast to the UniformContainer those Items can vary in height, a typical example include messages or news entries.
In combination with data storage like de.enough.polish.io.ChunkedStorageCollection, de.enough.polish.io.ChunkedStorageRmsSystem and the like you can create endless scrolling screens.


The de.enough.polish.ui.UniformContainer along with the convenience de.enough.polish.ui.UniformForm allow you to show vast numbers of entries without using too much memory.
For best memory efficiency the UniformContainer reuses items - for doing that you need to supply a de.enough.polish.ui.UniformItemSource instead of an ItemSource. The UniformItemSource additionally defines a void populateItem(int itemIndex, Item item ) method for reusing items.
A UniformContainer only supports items that have the same height.

Sample App

Please compare the 'messaging' sample application for using ItemSource, UniformContainer and SourcedLazyContainer.


back to top