Java Programing laungage

J2ME Projects

J2ME Project 1

adplus-dvertising
Creating a J2ME Application for addTicker into Form
Previous Home Next

Ticker: Ticker is a piece of text that runs continuously across the display. The direction and speed of scrolling are determined by the implementation.

Ticker ticker= new Ticker("label");

Ticker Program


/*
 * Save as a addTicker.java
 */
package r4r.Mobile.Basic;

import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;

/**
 * @author R4R
 */
public class addTicker extends MIDlet {

     /* -- Private Field -- */
    private Display display;
    private Form form;
    private Ticker ticker;
    private Command exit;

    /* -- Default constructor -- */
    public addTicker() {
        display = Display.getDisplay(this);
        form = new Form("Add Ticker into form");
        ticker = new Ticker("See Ticker functionality");
        exit = new Command("EXIT", Command.EXIT, 1);
        
        // add field into form
        form.setTicker(ticker);
        form.addCommand(exit);
    }

    public void startApp() {
        form.setCommandListener(new CommandListener() {
				

            public void commandAction(Command c, Displayable d) {
                if (c == exit) {
                    destroyApp(true);
                    notifyDestroyed();
                }
            }
        });
        display.setCurrent(form);
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }
}


output
Previous Home Next