J2ME Polish
J2ME Polish 2.4 Documentation
Enough Software

Designing the Pressed Element

The user can select items like buttons, commands, and so on by pressing fire on the keyboard. In J2ME Polish you can give your user a visual feedback by defining a [style-name]:pressed style:

menuItem {
	padding: 2;
	font-color: black;

menuItem:hover {
	background-color: #222;
	font-color: white;

menuItem:pressed {
	background-color: #9f9;
	font-color: #222;

If you are targeting touch enabled devices (or a dynamic device such as Generic/AnyPhone and run the app on a touch enabled device), then J2ME Polish will use the :hover style when no :pressed style is defined.
If you don't want this behavior and only use :pressed when it is actually used and want to apply :hover styles on touch enabled devices as well, then you set the preprocessing variable polish.Item.UseHoverStylesForTouchSystems to true:

<variable name="polish.Item.UseHoverStylesForTouchSystems" value="true" />

You are not limited in the design, typically you will use a different background or a different border for the pressed state of an item, but depending on the item you can also exchange icon-images, font-styles, effects, animations and so on. Please refer to the visual guide for details on the design possibilities for each item.

The following example uses the particle view-type for giving visual feedback while the user holds down the fire key:

.mainCommand {
	padding: 0;
	padding-vertical: 0;
	icon-image: url( iconlarge%INDEX%.png );
	icon-image-align: top;
	layout: center;

.mainCommand:hover {
	font-style: bold;
	font-size: small;
	font-color: white;
	text-effect: shadow;

.mainCommand:pressed {
	view-type: particle;
back to top