javax.microedition.lcdui.Form Java Examples

The following examples show how to use javax.microedition.lcdui.Form. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VoteItem.java    From pluotsorbet with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a VoteItem.
 *
 * @param item Item we're voting on
 * @param preferredWidth Preferred width
 * @param listener Listener to signal of vote results
 * @param form parent BaseFormView
 */
public VoteItem(Voteable item, int preferredWidth, VoteListener listener,
    Form form, BaseFormView parent) {
    super(form, preferredWidth, null);

    this.item = item;
    this.parent = parent;
    this.voteImageWidth = voteDownImage.getWidth();
    this.voteImageHeight = voteDownImage.getHeight();
    this.height = getPrefContentHeight(width);
    this.listener = listener != null ? listener : new VoteListener() {

        public void voteSubmitted(int vote) {
        }
    };
    this.centerX = width / 2;

    if (TouchChecker.DIRECT_TOUCH_SUPPORTED) {
        LCDUIUtil.setObjectTrait(this, "nokia.ui.s40.item.direct_touch",
            new Boolean(true));
    }
}
 
Example #2
Source File: CommentItem.java    From pluotsorbet with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a CommentItem.
 * 
 * @param comment CommentThing represented by this item
 * @param listener Listener to signal of selections
 * @param preferredWidth Preferred width
 * @param form Parent form of this CommentItem
 */
public CommentItem(CommentThing comment, CommentSelectionListener listener,
    int preferredWidth, Form form) {
    super(form, preferredWidth, null);

    this.comment = comment;
    this.preferredWidth = preferredWidth;
    this.listener = listener;

    int level = comment.getLevel();
    this.xIndent = level == 0 ? 0 : Math.max(0, 12 * level) - (5 * (level
        - 1));
    this.bodyLines = getBodyLines();
    this.height = getPrefContentHeight(preferredWidth);
    this.metaText = comment.getCreated() == null ? "" : DatePrettyPrinter.
        prettyPrint(comment.getCreated()) + comment.getFormattedScore();

    if (TouchChecker.DIRECT_TOUCH_SUPPORTED) {
        LCDUIUtil.setObjectTrait(this, "nokia.ui.s40.item.direct_touch",
            new Boolean(true));
    }
}
 
Example #3
Source File: MicroActivity.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onContextItemSelected(@NonNull MenuItem item) {
	if (current instanceof Form) {
		((Form) current).contextMenuItemSelected(item);
	} else if (current instanceof List) {
		AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
		((List) current).contextMenuItemSelected(item, info.position);
	}

	return super.onContextItemSelected(item);
}
 
Example #4
Source File: LoginStatusItem.java    From pluotsorbet with GNU General Public License v2.0 5 votes vote down vote up
public LoginStatusItem(int preferredWidth, SelectionListener listener,
    Form form) {
    super(form, preferredWidth, null);

    this.height = getPrefContentHeight(width);
    this.listener = listener;
}
 
Example #5
Source File: LinkMetadataItem.java    From pluotsorbet with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a LinkMetadataItem.
 *
 * @param link LinkThing related to this item
 * @param preferredWidth Preferred width
 */
public LinkMetadataItem(LinkThing link, int preferredWidth, Form form) {
    super(form, preferredWidth, null);

    this.link = link;
    this.height = getPrefContentHeight(width);
}
 
Example #6
Source File: LinkItem.java    From pluotsorbet with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a Linkitem.
 *
 * @param link Link represented by the Linkitem
 * @param preferredWidth Preferred width
 * @param showSubreddit Whether the subreddit should be displayed
 * @param listener Listener to signal of link selections
 * @param imageCache A cache to store images into
 */
public LinkItem(LinkThing link, int preferredWidth, boolean showSubreddit,
    LinkSelectionListener listener, Hashtable imageCache, Form form) {
    super(form, preferredWidth, null);
    this.link = link;
    this.preferredWidth = preferredWidth;
    this.listener = listener;
    this.imageCache = imageCache;

    showImage = link.getThumbnail() != null;

    updateTitleLines();

    // E.g. "funny @ imgur.com", only "imgur.com" if a category is selected
    detailsText = (showSubreddit ? link.getSubreddit() + " @ " : "") + link.
        getDomain();
    updateDetailsLines();
    this.height = getPrefContentHeight(preferredWidth);

    if (TouchChecker.DIRECT_TOUCH_SUPPORTED) {
        LCDUIUtil.setObjectTrait(this, "nokia.ui.s40.item.direct_touch",
            new Boolean(true));
    }

    if (showImage) {
        loadImage();
    }
}
 
Example #7
Source File: TextItem.java    From pluotsorbet with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a TextItem with the specified font.
 *
 * @param text Item text
 * @param preferredWidth Preferred width
 * @param font Font to use
 */
public TextItem(String text, int preferredWidth, Font font, Form form) {
    super(form, preferredWidth, null);

    this.text = text;
    if (font != null) {
        this.font = font;
    }
    textLines = getTextLines();
    this.height = getPrefContentHeight(width);
}
 
Example #8
Source File: AudioRecorder.java    From pluotsorbet with GNU General Public License v2.0 5 votes vote down vote up
protected void startApp() throws MIDletStateChangeException {
	this.recordButton = new StringItem(null, "Start", Item.BUTTON);
	Command toggleRecordingCMD = new Command("Click", Command.ITEM, 1);
	this.recordButton.addCommand(toggleRecordingCMD);
	this.recordButton.setDefaultCommand(toggleRecordingCMD);
	this.recordButton.setItemCommandListener(this);

	this.form = new Form(null, new Item[] {
			new StringItem(null, "Audio Recorder"), this.recordButton });

	this.display = Display.getDisplay(this);
	this.display.setCurrent(this.form);
}
 
Example #9
Source File: AbstractCustomItem.java    From pluotsorbet with GNU General Public License v2.0 4 votes vote down vote up
public AbstractCustomItem(Form form, int preferredWidth, String label) {
    super(label);
    this.width = preferredWidth;
}
 
Example #10
Source File: MoreCommentsItem.java    From pluotsorbet with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Create a MoreCommentsItem.
 * 
 * @param comment The CommentThing whose items we're dealing with
 * @param listener Listener to signal of eslections
 * @param preferredWidth Preferred width
 * @param form Parent form of this CommentItem
 */
public MoreCommentsItem(CommentThing comment,
    CommentSelectionListener listener, int preferredWidth, Form form) {
    super(comment, listener, preferredWidth, form);
    this.height = getPrefContentHeight(preferredWidth);
}
 
Example #11
Source File: TextItem.java    From pluotsorbet with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Create a TextItem with the default font.
 * 
 * @param text Item text
 * @param preferredWidth Preferred width 
 */
public TextItem(String text, int preferredWidth, Form form) {
    this(text, preferredWidth, null, form);
}