?? listimage.java
字號:
package com.jmobilecore.ui.core;
import javax.microedition.lcdui.Image;
/**
* Provides an image for display as part of <code>List</code> component. <code>ListImage</code> is focusable.
*
* @author Greg Gridin
*/
public class ListImage extends ImageComponent implements ListComponent {
/**
* The textual description of the image.
* @see #getText
* @see #setText
*/
protected String text;
/**
* A key stoke that ia associated with a list item.
* To remove you have to assign to it <code>PlatformCanvas.KEY_UNDEFINED</code> value
* @see #getShortcut
* @see #setShortcut
*/
protected int shortcut = PlatformCanvas.KEY_UNDEFINED;
/**
* This field indicates the command has been issued by a particular list item.
* By default the <code>actionCommand</code> is the image of the <code>ListImage</code>,
* unless it has been explicitly set to a different value.
* @see #getAction
* @see #setAction
*/
protected Object actionCommand = null;
/**
* Create a list image
*
* @param image the label for this list image.
*/
public ListImage(Image image) {
this(image, PlatformCanvas.KEY_UNDEFINED, image);
}
/**
* Create a list image with an associated keyboard shortcut.
*
* @param image the label for this list image.
* @param shortcut key code associated witha list image.
*/
public ListImage(Image image, int shortcut) {
this(image, shortcut, image);
}
/**
* Create a list image with an associated keyboard shortcut and custom action.
*
* @param image the label for this list image.
* @param shortcut key code associated witha list image.
* @param action custom action for the <code>ListImage</code>
*/
public ListImage(Image image, int shortcut, Object action) {
super(image, Label.LEFT);
setShortcut(shortcut);
setAction(action);
focusable = true;
}
/**
* Get textual representation of the <code>ListImage</code> component
* This method is required by <code>ListComponent</code> interface
*
* @return the textual representation of the component
*/
public String getText() {
return text;
}
/**
* Sets the key code shortcut for this <code>ListImage</code> component
* This method is required by <code>ListComponent</code> interface
*
* @param text the new textual representation of the component
*/
public void setText(String text) {
this.text = text;
}
/**
* Get the key code shortcut for this <code>ListImage</code>
* This method is required by <code>ListComponent</code> interface
*
* @return the keycode shortcut
*/
public int getShortcut() {
return shortcut;
}
/**
* Sets the key code shortcut for this <code>ListImage</code>
* This method is required by <code>ListComponent</code> interface
*
* @param shortcut the keycode - new shortcut value
*/
public void setShortcut(int shortcut) {
this.shortcut = shortcut;
}
/**
* Get the object representing the <code>ListImage</code>'s action
* This method is required by <code>ListComponent</code> interface
*
* @return the object associated with this <code>ListLabel</code>
*/
public Object getAction() {
return actionCommand;
}
/**
* Sets the object as <code>ListLabel</code>'s action
* This method is required by <code>ListComponent</code> interface
*
* @param action the object - new action value
*/
public void setAction(Object action) {
this.actionCommand = action;
}
/**
* Default destructor. Helps VM to perform garbage collection
*/
public void destructor() {
actionCommand = null;
super.destructor();
}
} // class ListImage
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -