MCQs Test!! VB Basic Test !! Essentials of VB !! Creating User Services !! function !! Anatomy !! GK March-2019 !! DATA TYPES IN JAVA !! Classes ,Constructor ,Methods,Inheritance !! Ecology-I !! Biology 2019 !! Gk april 2019 !! Biology (living world) !! Plant anatomy !! CELL STRUCTURES AND FUNCTION !! General biology !! Human physiology !! Data structure !! Ecology-II !! GK TEST !! Reproduction in plants !! Human reproduction !! The ABC of C !! Operating system set1 !! Operating system set2 !! Gk and current affairs !! Animal kingdom !! Number system !! Animal kingdom-II !! Gk TEST-III !! Number series !! Microorganisms !! Interview question in c !! Time and Work !! Percentage !! General history !! Average !! Cells !! Locomotion and Movement !! paging !! Bacteriology !! Page replacement policy !! Secondary memory and Disk scheduling !! Introduction of Nervous System and neurons !! Plant harmones !! Transport and Mineral Nutrition in Plants !! Neurotransmitters !! Modern Indian History !! Photosynthesis in Plants !! Modern Indian History-II !! Plant respiration !! Environment & Biodiversity !! Environment & Biodiversity - II !! Algae, Bryophytes, Pteridophytes !! Area !! Cricket !! Days of the Year (India and the World) !! Plant Pathology - I !! Indian Transport System !! Plant Pathology - II !! Aptitude !! Biology !! Botany !! C language !! Computer Science !! Core Java !! Gate !! GK !! Mysql !! Operating system !! Physics !! VB-Visual Basic !! Zoology

Java Programing laungage

J2ME Projects

J2ME Project 1

Creating a J2ME Application for addButton into Form
Previous Home Next

Application for addButton into Form

CommandThe Commands may be implemented in any user interface construct that has semantics for activating a single action.

Command command= new Command(lable, commandType, priority);

label = The label strings are what the application requests to be shown to the user to represent this command

commandType = The application uses the command type to specify the intent of this command

Priority = The application uses the priority value to describe the importance of this command relative to other commands on the same screen. Priority values are integers, where a lower number indicates greater importance.

Button Program


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

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

/**
 * @author R4R
 */
public class addButton extends MIDlet implements CommandListener {

    /* -- private field -- */
    private Form form;
    private Display display;
    private Command exit, select, help, back;

    /* -- Default constructor -- */
    public addButton() {
        display = Display.getDisplay(this);

        /* -- initialized field -- */
        form = new Form("Add Button into form");
        select = new Command("SELECT", Command.OK, 1);
        exit = new Command("EXIT", Command.EXIT, 1);
        help = new Command("HELP", Command.HELP, 2);
        back = new Command("BACK", Command.BACK, 2);

        /*-- Add button into form --*/
        form.addCommand(select);
        form.addCommand(help);
        form.addCommand(back);
        form.addCommand(exit);
				

        /* -- Add button functionality -- */
        form.setCommandListener(this);
    }

    public void startApp() {
        display.setCurrent(form);
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }

    public void commandAction(Command c, Displayable d) {
        if (c == exit) {
            destroyApp(true);   // invoked MIDlet to terminate state
            notifyDestroyed(); 
	// notify to application management software that MIDlet
	//has entered into Destroyed state.
        } else if (c == select) {
            // Add select button listner functionality. 
        } else if (c == help) {
            // Add help button listner functionality. 
        } else if (c == back) {
            // Add back button listner functionality. 
        }
    }
}

 

output
Previous Home Next