Skip to content

Planet-Source-Code/r-kistner-creating-a-cellphone-game-application__2-3066

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

Creating a Cellphone Game/Application

Description

Learn how to create a game or application for your cellphone.

More Info

Submitted On
By R. Kistner
Level Beginner
User Rating 4.4 (57 globes from 13 users)
Compatibility Java (JDK 1.2)
Category Miscellaneous
World Java
Archive File

Source Code

<style type="text/css"> A { COLOR: blue; TEXT-DECORATION: none } A:active { COLOR: blue; TEXT-DECORATION: underline } A:link { COLOR: blue; TEXT-DECORATION: none } A:visited { COLOR: blue; TEXT-DECORATION: none } A:hover { COLOR: blue; TEXT-DECORATION: underline } BODY { FONT-FAMILY: 'Trebuchet MS', 'comic sans ms', cursive, 'sans serif', serif, monospace } .code { COLOR: black; TEXT-INDENT: 10px } .code .keyword { FONT-WEIGHT: bold; COLOR: #000080 } .code .string { COLOR: #990000 } .code .number { COLOR: #0000ff } .code .comment { COLOR: #008000 } </style>

Creating Cellphone Game or Application

by Ralf Kistner

To create a game or application for your cellphone, you need the following:

Note: This is not a tutorial to teach you Java. You should be confident with Java before reading this tutorial.

Getting started with J2ME

Step 1: In J2ME Wireless Toolkit, create a new project. Give the project any name you want. Make the class name Main. You don't need to change any of the settings.

Step 2: Create [J2ME home dir]\apps\[project name]\src\Main.java with the following code:


import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.*;
public class Main extends MIDlet {
	private Form mainForm;
	public Main() {
		//create a new Form with the specified title
		mainForm = new Form("Hello World");
		//append a String to the form
		mainForm.append("Hello World!");
	}
	public void startApp () {
		//show the Form in the display area
		Display.getDisplay(this).setCurrent(mainForm);
	}
	public void destroyApp(boolean b) { }
	public void pauseApp() { }
}

Step 3: In J2ME, build the project. If you don't get any errors, you can run your program. A frame with a picture of a cellphone should pop up. Click on the button under launch and you should see "Hello World!".

Congratulations! You've just created your own cellphone application!

Step 4: To get it on your cellphone, you'll have to create a package (Project-> Package-> Create Package). See your cellphone's manual for futher instructions on how to put it on your cellphone.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published