Advanced Telecommunications Course Exercise 1 “NetBeans ...

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

5 Ιουν 2012 (πριν από 5 χρόνια και 5 μήνες)

458 εμφανίσεις

Advance
d Telecommunications Course


Exercise 1


“NetBeans Introduction”


By

Abdulla Al C
halati

(
wx08am6@student.lth.se
)

Karim Khalil

(
wx08kk9@student.lth.se
)

Mian Irfan

(
wx08im1@student.lth.se
)



Project Overview:


Welcome to the Java ME project web site.
The task is to develop a mobile application using the micro edition of

Java (Java ME).



The project in simple words is to connect to a common server and be able to exchange data with a mobile
phone via the telecom operator network.



The project consists

of four main sections:

1.

Login system

(Requirements: Working login application, interim report)

2.

Application protocol

(Requirement: Interim report)

3.

Full Application

(Requirements: Working application, source code)

4.

Project Report

(Requirement: Full report)


Note
s
;


As The Project will be implemented in Java and we are aware that not all of the student
s have good experience
wi
th Java
,
We have arranged an introductory classes for java beginners on 28
-
29/1 &
4
-
5/2 at the open
office hours in

room E:2520.


Java:


Java is an object oriented language very similar to C++ in terms of syntax .The object model is much
simpler and compil
ation technique varies from other object oriented language. One of the important aspect
of java is that it is platform independent. The source code after compilation is converted to byte code and
on different Machine we have relevant Java Virtual Machine (
In short JVM).Which reads the byte code
and do accordingly to specification of the machine its installed. Java normally comes in many flavors but
the important of them are as follow.



J2ME (java 2 micro edition).Used in programs
for

hand Held devices Limit
ed set of Libraries.


J2SE (java 2 standard Edition). Used for normal Programs run on Computers standard set of libraries.


J2EE (java 2 Enterprise Edition).Used for server side programs. Extended set of libraries.



Net beans:


Net
beans is

one of many IDEs
u
sed to write java programs.
Net
beans is

an open
source. It would be used
for the given project

because it

provide support
for

J2ME and is easy to understand and work with.


What are CLDC and MIDP?



Source:

java.sun.com/javame/technology/index.jsp




The

configuration targeting resource
-
constraint devices like mobile phones is called the
Connected
Limited Device Configuration (CLDC)
. It is specifically designed to meet the needs for a Java platform to
run on devices with lim
ited memory, processing power and graphical capabilities. On top of the different
configurations Java ME platform also specifies a number of profiles defining a set of higher
-
level APIs that
further define the application. A widely adopted example is to co
mbine the CLDC with the
Mobile
Information Device Profile (MIDP)

to provide a complete Java application environment for mobile phones
and other devices with similar capabilities.

With the configuration and profiles the actua
l application then resides, using the different available APIs in
the profile.



MIDlet:


A MIDlet is the application created by a Java ME software developer, such as a game, a business
application or other mobile features. These MIDlets can be written on
ce and run on every available device
conforming with the specifications for Java ME technology. The MIDlet can reside on a repository
somewhere in the ecosystem and the end user can search for a specific type of application and having it
downloaded over th
e air to his/her device.

Notes on MIDLET;

1.

An application written for MIDP is called a
MIDlet
.

2.

All MIDlets extend the MIDlet class:




public class MyMIDlet extends MIDlet { }

3.

The MIDlet class provides methods for starting, pausing, and terminating the MI
Dlet application:

• startApp()

• pauseApp()

• destroyApp(boolean unconditional)



Hello World Example

Routine
:


Steps :

1.

Open NetBeans, from Start


Java


Netbeans

2.

Open new Project.

3.

Choose Java ME then press Next

4.

Name the project


HelloWorld

, and unc
heck The create hello Midlet checkbox. Then
next

5.

Leave the CLDC
-
1.1 & MIDP
-
2.1 checked and press finish

6.

Then Right click on the project name on the left window, and press new

create
MIDLET, name the MIDP class name “
HelloWorld
”.

7.

Finally start programming
the Hello World Routine.

--------------------------------------------------------------------------------------------------------------------

import javax.microedition.midlet.*;

import javax.microedition.lcdui.*;



public class HelloWorld extends MIDlet i
mplements CommandListener


{

private Display display;


private Command exitCommand;


private TextBox tbox;


public void startApp()

{

display = Display.getDisplay(this);

exitCommand = new Command("Exit", Command.SCREEN, 1);


tbox = new TextBox("Hello world

MIDlet", "Hello World!", 25, 0);


tbox.addCommand(exitCommand);

tbox.setCommandListener(this);

display.setCurrent(tbox);


}


public void pauseApp()

{

}


protected void destroyApp(boolean unconditional)


{

}


public void commandAction(Command cmd, Displ
ayable disp)


{

if (cmd == exitCommand)

{



destroyApp(false);

notifyDestroyed();



}



}

}


-----------------------------------------------------------------------------------------------------------------------------
--------------


Useful web Pages
:



Web Page of the project at the course homepage.



Application programming interface JSR118

(
Most of the embedded classes in MID
)
http://java.sun.com/javame/reference/apis
/jsr118/