1

braintreesmileΛογισμικό & κατασκευή λογ/κού

15 Αυγ 2012 (πριν από 5 χρόνια και 6 μέρες)

247 εμφανίσεις

SA0942A Introduction to Mobile (Game) Programming

1
/
3

Tutorial 2

2.

Some More

J
2ME
.


1. What you need to run J2ME

at home.

The computer roo
m that you are in for practical work

has been set up to allow you to
develop and run your mobile games. I suspect that you will want to download some of
the software and create a devel
opment environment for your home computer. These are
the items you need to install.


You need to install the latest version of java, the wireless toolkits and an IDE. These can
be downloaded separately and indeed it may be a good idea to install some comp
onents
in addition to the default components.




Install the current version of
Java. The current version is 1.6

and can be
downloaded from
http://www.sun.co.uk

. You may need to register with Sun.
Registration is free.

Netbeans 6.1 runs quite happily with Java 1.5 and maybe
1.4.3.



Now you need to download and install an IDE. From
http://www.netbeans.org

d
ownload and install NetBeans 6.1.

There are a number of options here but th
e
one you need is the standard
version

plus the mobility. This comes with the java
wireless toolkit 2.5.2



If you want to be thorough you may wish to download earlier wireless toolkits.
Version 1.0.4 supports CLDC1 and MIDP1; version 2.2 supports MIPD2 but
an
earlier version than .25.2



Netbeans 6.1comes with

default emulators but it is better if you can get an
emulator for your phone. I have a
number of
Nokia 6230i phone
s that can be
borrowed for use on this course. Hence it is useful to have an emulator for

this
phone. You should install the
Nokia Series 40 Developer platform 2.0 SDK 6230i.
There are emulators for many phones available from Nokia and other
manufacturers

you may also like to install the emulator for your
own
phone.


2. A S
econd J2ME Program.

Packaged on the web site are
two

J2ME source files for a
picture

example.


drawShapes
.java

This defines the MIDlet that controls the application. It uses a
c
a
nvas to draw a circle in a rectangle.

draw
Canvas.java

This is the canvas or vi
e
w on the screen


Start a new NetBeans project and using the files on the website re
-
create the
application.




Run the application on the default emulator



You can set the project settings so that by default the application runs on another
emulator rather than the default em
ulator. You should investigate how to change
the project so that the application runs in the
Nokia S40 DP 2.0 SDK 6231i
.


Describe the main differences in running this programme on the two different emulators.












SA0942A Introduction to Mobile (Game) Programming

2
/
3

Tutorial 2


3. Files created in the project.

Once you got the example to work look at the files created in the project. Open some of
the important looking files to see the contents. Now report on your findings.


Folder

Filename

Description













































4. Ext
end the program.

The example above shows a red circle in a grey background. Draw out on apiece of
paper a more complex shape. Now amend the program so that your more complex
shape is drawn on the screen. You will need to find out about the library and what

methods are available. There are many resources on the Internet that give details of
J2ME facilities


pick one.


Get your program running on the default emulator and if possible on the Nokia 6230i
emulator.


4.
Deployment to a real phone.

There is no fac
ility on the machines in 3500 to dow
nload an application to a phone. T
he
use of software such as PCSuite requires many personal settings and is more appropriate
for use on a single user PC. The steps below will allow you to deploy to a phone over the
air.




Step 1 :

The first step is to put the relevant files onto a web site. You have been
allocated space on the cctstudent.abertay.ac.uk server. Use
FileZilla

to
upload the
files to the server. Do not store your password within the
FileZilla
; leave it blank
so

that the software asks for your password every time you use it. Copy the .jad
and .jar files to the public_html folder (or a subfolder of this).



Step 2 :

test the installation on the emulator. Run the Nokia 6230i emulator on
the PC. Use the Web menu, and
goto the address


http://cctstudent.abertay.acv.uk/~g510572/drawShapes.jad

where g510572

is
replaced by your ID. The emulator will ask you if you trust the site and then ask
SA0942A Introduction to Mobile (Game) Programming

3
/
3

Tutorial 2

you if
you want the program loaded. Answer yes to both. Now run the application
from the emulator.



Step 3 :

Now repeat step 2 but this time use a real phone. I can lend you a Nokia
6230i phone but you may like to do this on your own phone. I leave it to you
wheth
er you “trust” the writer of the
application
.



You should n
ote 2 things from this exercise:


1.

How large (small?)

is the application you have written. When you load the
application it gives the size.

2.

How difficult it is to type in a web address to a real ph
one. What can be done
about this?