Top Banner

of 131

MAD Master Lab Manual (Final)

Jul 05, 2018

Download

Documents

Naresh Paikaray
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 8/16/2019 MAD Master Lab Manual (Final)

    1/131

    Geethanjali College of Engineering andTechnology

    Çheeryal (V), Keesara (M), Ranga Reddy District

      MOBILE APPLICATIONS DEVELOPMENT

    MASTER LABORATORY MANUAL

      DEPARTMENT OF

      INFORMATION TECHNOLOGY

      Lab In-Charge   HOD-IT

      K.SRINIVAS Dr. K. SRINIVAS

      A!. Pr"#. Pr"#. $ Hea%

  • 8/16/2019 MAD Master Lab Manual (Final)

    2/131

    2

    Geethanjali College of Engineering and Technology

    Department of Information Technology

    (Name of the Lab Course) MOBILE APPLICATIONS

    DEVELOPMENT

      ( !NT" C#DE) $%&'%rogramme "G

    *ranch IT +ersionNo

     ,ear I+ "pdatedon -./&'/-&.0

    1emester I No2 ofpages .3.

    Classi4cation status ("nrestricted 5 6estricted )

    Distribution List Department7 Lab7 Library7 Lab In Charge

    repared by 8odi4ed by

    .) Name 92 16INI+$1 .) Name

    -) 1ign -) 1ign

      3) Design $sst2 rof 2 3) Design

    :) Date -./&'/-&.0 :) Date  

    +eri4ed by

    .) Name -) 1ign

    3) Design

    :) Date

    ; ed by (?#D )

    .) Name Dr2 92 16INI+$1 -) 1ign 3) Date

  • 8/16/2019 MAD Master Lab Manual (Final)

    3/131

    &. SYLLABUS

    'ee( - &) Installation of Java wireless Toolkit (J2ME)

    'ee( - *) Working with J2ME Features

    'ee( - +) Threads & High Level I

    'ee( - ,) Working on !rawing and I"ages

    'ee( - ) !evelo#ing $etworked %##liations using the Wireless Toolkit

    'ee( - ) %uthentiation with a We' erver 

    'ee( - / $ 0) We' %##liation using J2ME

  • 8/16/2019 MAD Master Lab Manual (Final)

    4/131

    *. L1! "# E2er31e

    S.N" E24er15en! Page.N"

    * +reate a #rogra" to #rint ,Hello World- !"

    2+reate a #rogra" whih reates "enu that ontains o#./ ut/ #aste/ delete/ selet

    all/ unselet all o#tions!#

    0 +reate a #rogra" that #erfor"s Event Handling 2"

    1

    +reate a slide show whih has three slides/ whih inludes onl. tet 3rogra"

    should hange to the new slide after 4 seonds %fter the third slide #rogra"

    returns to the first slide

    !

    4+reate a slide show whih has three slides/ whih inludes #itures at 3$5 for"at

    3rogra" should hange to the new slide other 4 seonds#

    6

    +reate a MI!3 a##liation/ whih show to the user 47*8 9ui: 9uestions %ll

    9uestions have 1 #ossi'le o#tions and one right o#tion eatl. %##liation ounts

    and shows to the user how "an. right answers were right and shows the" to user "$

    ;+reate a MI!3 a##liation whih Ea"ine /that a #hone nu"'er/ whih a user

    entered in given for"at$2

    <+reate a MI!3 a##liation/ whih draws a 'ar gra#h to the dis#la. !ata values

    an 'e given at int=> arra.$%

    ?

    +reate a MI!3 a##liation/ whih draws a #ie hart to the dis#la. !ata values an

     'e given at int=> arra. @ou an enter four data (integer) values to the in#ut tet

    field

    &$

    *8+reate a sa"#le #rogra" that shows how to dis#la. a si"#le LA5I$ +BEE$ on

    the J2ME #hone and how to authentiate to a HTT3 server#

    ** +reate a !atagra" server #roCet #%

    "

  • 8/16/2019 MAD Master Lab Manual (Final)

    5/131

    +. ADDITIONAL PROGRAMS

    S.N" E24er15en! Page.N"

    * +reate a MI!3 a##liation/ whih reates Muta'le I"age %&

    2 +reate a MI!3 a##liation/ whih reates I""uta'le I"age !'

    0 +reate a MI!3 a##liation/ whih reates $on7interative gauge !'#

    1 +reate a MI!3 a##liation/ whih reates Interative gauge !!

  • 8/16/2019 MAD Master Lab Manual (Final)

    6/131

    ,.  MICRO PLAN

    S.N" Da!e E24er15en!

    * *;D6D*6 +reate a #rogra" to #rint ,Hello World-

    2 21D6D*6 +reate a #rogra" whih reates "enu that ontains o#./ ut/ #aste/ delete/ selet all/

    unselet all o#tions

    0 *D;D*6 +reate a #rogra" that #erfor"s Event Handling

    1 *4D;D*6 +reate a slide show whih has three slides/ whih inludes onl. tet 3rogra" should

    hange to the new slide after 4 seonds %fter the third slide #rogra" returns to the

    first slide

    4 22D;D*6 +reate a slide show whih has three slides/ whih inludes #itures at 3$5 for"at

    3rogra" should hange to the new slide other 4 seonds

    6 2?D;D*6 +reate a MI!3 a##liation/ whih show to the user 47*8 9ui: 9uestions %ll 9uestions

    have 1 #ossi'le o#tions and one right o#tion eatl. %##liation ounts and shows to

    the user how "an. right answers were right and shows the" to user 

    ; 4D arra. @ou an enter four data (integer) values to the in#ut tet field

    *8 26D

  • 8/16/2019 MAD Master Lab Manual (Final)

    7/131

    . INVIDUAL TIME TABLE

      /. LAB OB6ECTIVE

    &

  • 8/16/2019 MAD Master Lab Manual (Final)

    8/131

    In this la'/ a student is e#eted to design/ i"#le"ent/ dou"ent and #resent a "o'ile

    lientDserver s.ste" using standard Java and Java 2 Miro Edition (J2ME) #latfor" #eifiall. it is

    re9uired to design and i"#le"ent a s.ste" that onsists "ainl. of a "o'ile lient (M+) and a 3ro.

    erver (3) M+ will 'e written in J2ME/ MI!3 28/ while 3 will 'e written in standard Java It is

    neessar. to use a "o'ile #hone e"ulator to develo# and de"onstrate the e#eri"ents

    It "a. 'e neessar. to use other o"#onents or eisting resoures (servers) as needed For 

    instane a data'ase loal to 3 or a we' servie availa'le on the Internet that an 'e invoked '. the 3

    /.& LAB OUTCOMES

    * e a'le to disuss the overview of "o'ile a##liations and its 'enefits

    2 Identif. the harateristis of the J2ME

    0 e a'le to develo# the %##liations

    1 e a'le to anal.:e and o"#are advaned lasses and interfaes

    0. In!a771ng 4r"3e%8re "# 6*ME '1re7e T""7(1!

    #

  • 8/16/2019 MAD Master Lab Manual (Final)

    9/131

    *) If the Java !evelo#"ent it (J!) is not there or onl. having the Java Bunti"e Environ"ent (JBE)

    installed/ install the latest J! fro" htt#GDDCavasuno"DCavaseDdownloadsDindeCs# +urrent sta'le

    release of Java is J! 6 #date ; 'ut hek the we' #age in ase there are newer non7'eta releases

    availa'le

    2) $et/ download the 6a9a '1re7e T""7(1! (for"erl. alled J2ME Wireless Toolkit) fro"G

    htt#GDDCavasuno"D#rodutsDsCwtoolkitDdownloadht"l

    0) Bun the installer (for ea"#le/ for Windows it isG sunCavawirelesstoolkit7 242 windowsee)

    The installer heks whether a o"#ati'le Java environ"ent has 'een #re7installed If not/ it is neessar.

    to uninstall old versions of Java and #erfor" te# * again

    Ane after suessful installation of Java and the tool kit o"#ile this #rogra" and run the following

     #rogra" in the toolkit

    te#s to run this #rogra" in toolkitG

    * tart 7 %ll 3rogra"s 7 un Java Tool it 7 Wireless Tool it

    2 +lik $ew 3roCet Enter 3roCet $a"e 7 Enter +lass $a"e 7 +lik on +reate 3roCet

    0 +hoose a##ro#riate %3I eletion and +onfigurations1 3lae Java oure file in WT2* D WT22Ka##sK#roCetna"eKsr

    4 uild the 3roCet

    6 Bun the 3roCet

    %

  • 8/16/2019 MAD Master Lab Manual (Final)

    10/131

     :. VISION OF THE DEPARTMENT

    To #rodue glo'all. o"#etent and soiall. res#onsi'le o"#uter siene engineers ontri'uting

    to the advane"ent of engineering and tehnolog. whih involves reativit. and innovation '.

     #roviding eellent learning environ"ent with world lass failities

    &;. MISSION OF THE DEPARTMENT

    * To 'e a enter of eellene in instrution/ innovation in researh and sholarshi#/ and servie to the

    stake holders/ the #rofession/ and the #u'li

    2 To #re#are graduates to enter a ra#idl. hanging field as a o"#etent o"#uter siene engineer

    0 To #re#are graduate a#a'le in all #hases of software develo#"ent/ #ossess a fir" understanding of 

    hardware tehnologies/ have the strong "athe"atial 'akground neessar. for sientifi

    o"#uting/ and 'e suffiientl. well versed in general theor. to allow growth within the disi#line as

    it advanes

    1 To #re#are graduates to assu"e leadershi# roles '. #ossessing good o""uniation skills/ the

    a'ilit. to work effetivel. as tea" "e"'ers/ and an a##reiation for their soial and ethial

    res#onsi'ilit. in a glo'al setting

      &&. PEOS AND POS

    !'

  • 8/16/2019 MAD Master Lab Manual (Final)

    11/131

    PROGRAM EDUCATIONAL OB6ECTIVES

  • 8/16/2019 MAD Master Lab Manual (Final)

    12/131

    !! % reognition of the need for and an a'ilit. to engage in life7long learning and ontinuing

     #rofessional develo#"ent

    !2 nowledge of onte"#orar. issues! %n a'ilit. to a##l. design and develo#"ent #rini#les in #roduing software s.ste"s of 

    var.ing o"#leit. using various #roCet "anage"ent tools!" %n a'ilit. to identif./ for"ulate and solve innovative engineering #ro'le"s

    !2

  • 8/16/2019 MAD Master Lab Manual (Final)

    13/131

    &*. C"8re 5a441ng >1!h Pr"gra55e O8!3"5e

    Ma441ng "# C"8re !" PEO an% P"

    M%!3EA*/3EA23A2/3A1/3A4/3A6/3A

  • 8/16/2019 MAD Master Lab Manual (Final)

    14/131

    E24er15en! & G Crea!e a 4r"gra5 !" 4r1n! ?He77" '"r7%@

    Obe3!19e) To #rint ,Hello World- in e"ulator

    O8!3"5e ) Identif. the harateristis of the J2ME

    A7g"r1!h5)

    te#7*G7tart 7%ll3rogra"s7un Java Tool it7Wireless Tool it

    te#72G7+lik $ew 3roCet Enter #roCet $a"e as FirstMidlet 7 Enter +lass$a"e as HelloMidlet7

    lik on +reate 3roCet

    te#70G7 % setting window will o#en u# %e#t the defaults '. liking ok in that window

    !"

  • 8/16/2019 MAD Master Lab Manual (Final)

    15/131

    te#717777I"#ort the #akages needed to run the MI!let

    te#747777!elare the varia'les needed in the MI!let

    te#76777 tart the life .le of MI!let

    te#7;7777Write the "ethods re9uired

    start%##()/#ause%##()/destro.%##()

    te#7

  • 8/16/2019 MAD Master Lab Manual (Final)

    16/131

    F7">3har!)

    !$

  • 8/16/2019 MAD Master Lab Manual (Final)

    17/131

    Pr"gra5)

    i"#ort Cava"iroedition"idlet

    i"#ort Cava"iroeditionldui

     #u'li lass HelloMidlet etends MI!letN

     #u'li HelloMidlet()

    N

     O

     #u'li void start%##()

    N

    For" for" P new For"( QFirst 3rogra"Q )

    for"a##end( QHello WorldQ )

    !is#la.get!is#la.(this)set+urrent( for" )

    O

     #u'li void #ause%##()

    N

    O

     #u'li void destro.%##( 'oolean unonditional )

    N

    O

    O

    !&

  • 8/16/2019 MAD Master Lab Manual (Final)

    18/131

    OUTPUT)

     

    !#

  • 8/16/2019 MAD Master Lab Manual (Final)

    19/131

    E24er15en! *) Crea!e a 4r"gra5 >h13h 3rea!e !" #"77">1ng (1n% "# 5en8.

    ut o#.

    #ast

    delete selet all

    unselet all

    Obe3!19e) %'le to understand J2ME features

    O8!3"5e) nowledge a'out the MI!let lass

    A7g"r1!h5

    te#7*7777I"#ort the #akages needed to run the MI!let and i"#le"ents the interfae needed

    te#727777!elare the varia'les needed in the MI!let

    te#70777 tart the life .le of MI!let

    te#717777Write the "ethods re9uired

    start%##()/#ause%##()/destro.%##()

    te#74777 5ive the "enu ite"s re9uired

    radiouttons P new +hoie5rou#( Qelet @our +hoieQ/ +hoieER+LISE)

    te#767777%dd the "enu to the e"ulator

    !%

  • 8/16/2019 MAD Master Lab Manual (Final)

    20/131

    F7">3har!

    2'

  • 8/16/2019 MAD Master Lab Manual (Final)

    21/131

    Pr"gra5)

    i"#ort Cava"iroedition"idlet

    i"#ort Cava"iroeditionldui

     #u'li lass Menu+reation etends MI!let i"#le"ents +o""andListener

    N

      #u'li +hoie5rou# h

      #u'li For" for"

      #u'li !is#la. dis#la.

      #u'li +o""and "d

      #u'li tringIte" st

      #u'li Menu+reation()

      N

      dis#la.P!is#la.get!is#la.(this)

      hPnew +hoie5rou#(QEditQ/+hoieER+LISE)

      ha##end(QutQ/null)

      ha##end(Qo#.Q/null)

      ha##end(Q#asteQ/null)

      ha##end(QdeleteQ/null)

      ha##end(Qselet allQ/null)

      ha##end(Qunselet allQ/null)

      hseteletedInde(*/ true)

      "dPnew +o""and(Qelet list ite"Q/+o""andA/*)

      for"Pnew For"(QQ)

      for"a##end(h)

      for"add+o""and("d)

      for"set+o""andListener(this)

    2!

  • 8/16/2019 MAD Master Lab Manual (Final)

    22/131

      stPnew tringIte"(QQ/QQ)

      O

      #u'li void start%##()

    N

      dis#la.set+urrent(for")

      O

      #u'li void #ause%##()

    N

      O

      #u'li void destro.%##('oolean unonditional)

    N

      O

      #u'li void o""and%tion(+o""and o""and/!is#la.a'le dis#la.a'le)

      N

      if(o""andPP"d)

      N

      stsetTet(QQ)

      stsetTet(Q.our seleted o#tion is Qhgettring(hgeteletedInde()))

      for"a##end(st)

      OOO

    22

  • 8/16/2019 MAD Master Lab Manual (Final)

    23/131

    OUTPUT)

     

    2

  • 8/16/2019 MAD Master Lab Manual (Final)

    24/131

    E24er15en! +) Crea!e a 5en8 >h13h ha !he #"77">1ng "4!1"n)

    ut 7 an 'e onDoff 

    o#. 7 an 'e onDoff

    #aste 7 an 'e onDoff 

    delete 7 an 'e onDoff 

    selet all 7 #ut all 1 o#tions on

    unselet all 7 #ut all 1 o#tions off 

    Obe3!19e) %'le to understand J2ME features

    O8!3"5e) nowledge a'out the MI!let lass

    A7g"r1!h5

    te#7*7777I"#ort the #akages needed to run the MI!let and i"#le"ents the interfae needed

    te#727777!elare the varia'les needed in the MI!let

    te#70777 tart the life .le of MI!let

    te#717777Write the "ethods re9uired

    start%##()/#ause%##()/destro.%##()

    te#74777 5ive the "enu ite"s re9uired

    radiouttons P new +hoie5rou#( Qelet @our +hoieQ/ +hoieER+LISE)

    te#767777%dd the "enu to the e"ulator

    2"

  • 8/16/2019 MAD Master Lab Manual (Final)

    25/131

    F7">3har!

    2

  • 8/16/2019 MAD Master Lab Manual (Final)

    26/131

    Pr"gra5)

    i"#ort Cava"iroedition"idlet

    i"#ort Cava"iroeditionldui

     #u'li lass MenuEvents etends MI!let i"#le"ents +o""andListener/Ite"tateListener

    N

      #u'li +hoie5rou# h

      #u'li +hoie5rou# h*

      #u'li For" for"

      #u'li For" for"*

      #u'li !is#la. dis#la.

      #u'li +o""and Siew

      #u'li +o""and Eit

      #u'li +o""and ak

      #u'li tringIte" o#tions

      #u'li Ite" ite"

      #u'li MenuEvents()

      N

      dis#la.P!is#la.get!is#la.(this)

      for"Pnew For"(QQ)

      for"*Pnew For"(Qelted A#tions areQ)

      hPnew +hoie5rou#(Q3referenesQ/+hoieMLTI3LE)

      ha##end(QutQ/null)  ha##end(Qo#.Q/null)

      ha##end(Q#asteQ/null)

      ha##end(QdeleteQ/null)

      hseteletedInde(*/ true)

    2$

  • 8/16/2019 MAD Master Lab Manual (Final)

    27/131

      for"a##end(h)

      h*Pnew +hoie5rou#(QQ/+hoieER+LISE)

      h*a##end(Qselet allQ/null)

      h*a##end(Qunselet allQ/null)

      h*seteletedInde(*/ true)

      for"a##end(h*)

      SiewPnew +o""and(QSiewQ/+o""andA/*)

      Eit Pnew +o""and(QEitQ/+o""andERIT/*)

      akPnew +o""and(QakQ/+o""and%+/*)

      for"add+o""and(Siew)

      for"add+o""and(Eit)

      for"*add+o""and(ak)

      for"set+o""andListener(this)

      for"*set+o""andListener(this)

      for"setIte"tateListener(this)

    O

      #u'li void start%##()

    N

      dis#la.set+urrent(for")

      O

      #u'li void #ause%##()

    N

      O

      #u'li void destro.%##('oolean unonditional)

    N

      O

      #u'li void o""and%tion(+o""and o""and/!is#la.a'le dis#la.a'le)

    2&

  • 8/16/2019 MAD Master Lab Manual (Final)

    28/131

      N

      if(dis#la.a'lePPfor")

      N

      if(o""andPPSiew)

      N

      'oolean o#t=>Pnew 'oolean=hsi:e()>

      o#tionsPnew tringIte"(QQ/QQ)

      tring valuesPQQ

      hgeteletedFlags(o#t)

      o#tionssetTet(QQ)

    for(int iP8iUo#tlengthi)

      N

      if(o#t=i>)

      N

      valuesPhgettring(i)QKnQ

      O

      O

      o#tionssetTet(values)

      for"*a##end(o#tions)

      dis#la.set+urrent(for"*)

      O

      else if(o""andPPEit)

      N

      destro.%##(true)

      notif.!estro.ed()

      O

    O

    2#

  • 8/16/2019 MAD Master Lab Manual (Final)

    29/131

      else if(dis#la.a'lePPfor"*)

      N

      if(o""andPPak)

      N

      dis#la.set+urrent(for")

      o#tionssetTet(QQ)

      O

    O

      O

      #u'li void ite"tate+hanged(Ite" ite")

      N

      if(ite"PPh*)

      N

      int iP8

      int si:ePhsi:e()

      while(iUsi:e)

      N

      if(h*geteletedInde()PP8)

      hseteletedInde(i/ true)

      else

      hseteletedInde(i/ false)

      i

      O

      O

      O

    O

    2%

  • 8/16/2019 MAD Master Lab Manual (Final)

    30/131

    OUTPUT)

    '

  • 8/16/2019 MAD Master Lab Manual (Final)

    31/131

    E24er15en! ,) Crea!e a 71%e h"> >h13h ha !hree 71%e >h13h 1n378%e "n7 !e2!. Pr"gra5

    h"87% 3hange !" !he ne> 71%e a#!er e3"n%. A#!er !he !h1r% 71%e 4r"gra5 re!8rn !" !he #1r!

    71%e.

     

    Obe3!19e) %'le to understand J2ME features

    O8!3"5e) nowledge a'out the MI!let lass

    A7g"r1!h5

    te#7*7777I"#ort the #akages needed to run the MI!let and i"#le"ents the interfae needed

    te#727777!elare the varia'les needed in the MI!let

    te#70777 tart the life .le of MI!let

    te#717777Write the "ethods re9uired

    start%##()/#ause%##()/destro.%##()

    te#74777 5ive the "enu ite"s re9uired

    te#767777Bun the slide show

    te#7;7777set the ti"e 'etween different

    !

  • 8/16/2019 MAD Master Lab Manual (Final)

    32/131

    F7">3har!

    2

  • 8/16/2019 MAD Master Lab Manual (Final)

    33/131

    Pr"gra5)

    i"#ort Cava"iroedition"idlet

    i"#ort Cava"iroeditionldui

     #u'li lass lidehow etends MI!let i"#le"ents +o""andListener N

      #u'li For" slide*

      #u'li For" slide2

      #u'li For" slide0

      #u'li +o""and Eit

      #u'li !is#la. dis#la.

      #u'li lidehow()

      N

      dis#la.P!is#la.get!is#la.(this)

      EitPnew +o""and(QEitQ/+o""andERIT/*)

      slide*Pnew For"(Qlide*Q)

      slide*a##end(QThis is lide nu"'er *Q)

      slide*add+o""and(Eit)

      slide2Pnew For"(Qlide2Q)

      slide2a##end(QThis is lide nu"'er 2Q)

      slide2add+o""and(Eit)

      slide0Pnew For"(Qlide0Q)

      slide0a##end(QThis is lide nu"'er 0Q)

      slide0add+o""and(Eit)

      slide*set+o""andListener(this)

      slide2set+o""andListener(this)

      slide0set+o""andListener(this)

      O

  • 8/16/2019 MAD Master Lab Manual (Final)

    34/131

      #u'li void start%##() N

      Thread runner P new Thread(new ThreadBunner(dis#la./slide*/slide2/slide0))

      runnerstart()

      O

      #u'li void #ause%##() N

      O

      #u'li void destro.%##('oolean unonditional) N

      O

      #u'li void o""and%tion(+o""and o""and/!is#la.a'le dis#la.a'le)

      N

      if(dis#la.a'lePPslide*)

      N

      if(o""andPPEit)

      notif.!estro.ed()

      O

     else if(dis#la.a'lePPslide2)

      N

      if(o""andPPEit)

      notif.!estro.ed()

      O

      else if(dis#la.a'lePPslide0)

      N

      if(o""andPPEit)

      notif.!estro.ed()

    "

  • 8/16/2019 MAD Master Lab Manual (Final)

    35/131

      O

      O

    O

    lass ThreadBunner i"#le"ents Bunna'le N

      !is#la. dis#la.

      #u'li int P8

      #u'li For" slide*

      #u'li For" slide2

      #u'li For" slide0

      #u'li ThreadBunner(!is#la. dis#la./For" slide*/For" slide2/For" slide0) N

      thisdis#la. P dis#la.

      thisslide*Pslide*

      thisslide2Pslide2

      thisslide0Pslide0

      O

      #u'li void run() N

      while(true)

      N

     

      if(PP*)

      dis#la.set+urrent(slide*)

      else if(PP2)

      dis#la.set+urrent(slide2)

      else if(PP0)

      dis#la.set+urrent(slide0)

  • 8/16/2019 MAD Master Lab Manual (Final)

    36/131

      else if(PP1)

      P8

     

    tr.

      N

      Threadslee#(*488)

      O

      ath(Ee#tion e)

      N

      O

      O

      O

    O

    $

  • 8/16/2019 MAD Master Lab Manual (Final)

    37/131

    OUTPUT)

     

    &

  • 8/16/2019 MAD Master Lab Manual (Final)

    38/131

    E24er15en! ) Crea!e a 71%e h"> >h13h ha !hree 71%e >h13h 1n378%e 413!8re a! PNG #"r5a!.

    Pr"gra5 h"87% 3hange !" !he ne> 71%e "!her e3"n%.

    Obe3!19e) %'le to understand J2ME features

    O8!3"5e) nowledge a'out the MI!let lass

    A7g"r1!h5

    te#7*7777I"#ort the #akages needed to run the MI!let and i"#le"ents the interfae needed

    te#727777!elare the varia'les needed in the MI!let

    te#70777 tart the life .le of MI!let

    te#717777Write the "ethods re9uiredstart%##()/#ause%##()/destro.%##()

    te#74777 5ive the "enu ite"s re9uired

    te#767777Bun the slide show

    te#7;7777insert the i"ages into resoure folder

    te#7

  • 8/16/2019 MAD Master Lab Manual (Final)

    39/131

    F7">3har!

    %

  • 8/16/2019 MAD Master Lab Manual (Final)

    40/131

    Pr"gra5)

    i"#ort Cava"iroedition"idlet

    i"#ort Cava"iroeditionldui

     #u'li lass i"agelidehow etends MI!let i"#le"ents +o""andListener N

      #u'li For" slide*

      #u'li For" slide2

      #u'li For" slide0

      #u'li +o""and Eit

      #u'li !is#la. dis#la.

      #u'li I"age i"age*

      #u'li I"age i"age2

      #u'li I"age i"age0

      #u'li I"ageIte" i"ageite"*

      #u'li I"ageIte" i"ageite"2

      #u'li I"ageIte" i"ageite"0

      #u'li i"agelidehow()

      N

    dis#la.P!is#la.get!is#la.(this)

      tr.

      N

      i"age*PI"agereateI"age(QD*#ngQ)

      i"age2PI"agereateI"age(QD2#ngQ)

      i"age0PI"agereateI"age(QD0#ngQ)  i"ageite"*Pnew I"ageIte"(null/i"age*/I"ageIte"L%@AT+E$TEB/Qi"age*Q)

      i"ageite"2Pnew I"ageIte"(null/i"age2/I"ageIte"L%@AT+E$TEB/Qi"age2Q)

      i"ageite"0Pnew I"ageIte"(null/i"age0/I"ageIte"L%@AT+E$TEB/Qi"age0Q)

      O

    "'

  • 8/16/2019 MAD Master Lab Manual (Final)

    41/131

      ath(Ee#tion e)

      N

      O

     

    EitPnew +o""and(QEitQ/+o""andERIT/*)

      slide*Pnew For"(Qlide*Q)

      slide*a##end(i"ageite"*)

      slide*add+o""and(Eit)

      slide2Pnew For"(Qlide2Q)

      slide2a##end(i"ageite"2)

      slide2add+o""and(Eit)

      slide0Pnew For"(Qlide0Q)

      slide0a##end(i"ageite"0)

      slide0add+o""and(Eit)

      slide*set+o""andListener(this)

      slide2set+o""andListener(this)

      slide0set+o""andListener(this)

      O

      #u'li void start%##() N

      Thread runner P new Thread(new ThreadBunner(dis#la./slide*/slide2/slide0))

      runnerstart()

      O

      #u'li void #ause%##() N

      O

    "!

  • 8/16/2019 MAD Master Lab Manual (Final)

    42/131

      #u'li void destro.%##('oolean unonditional) N

      O

      #u'li void o""and%tion(+o""and o""and/!is#la.a'le dis#la.a'le)

      N

      if(dis#la.a'lePPslide*)

      N

      if(o""andPPEit)

      notif.!estro.ed()

      O

     else if(dis#la.a'lePPslide2)

      N

      if(o""andPPEit)

      notif.!estro.ed()

      O

      else if(dis#la.a'lePPslide0)

      N

      if(o""andPPEit)

      notif.!estro.ed()

      O

      O

    O

    lass ThreadBunner i"#le"ents Bunna'le N

    "2

  • 8/16/2019 MAD Master Lab Manual (Final)

    43/131

      !is#la. dis#la.

      #u'li int P8

      #u'li For" slide*

      #u'li For" slide2

      #u'li For" slide0

      #u'li ThreadBunner(!is#la. dis#la./For" slide*/For" slide2/For" slide0) N

      thisdis#la. P dis#la.

      thisslide*Pslide*

      thisslide2Pslide2

      thisslide0Pslide0

      O

      #u'li void run() N

      while(true)

      N

     

      if(PP*)

      dis#la.set+urrent(slide*)

      else if(PP2)

      dis#la.set+urrent(slide2)

      else if(PP0)

      dis#la.set+urrent(slide0)

      else if(PP1)

      P8

     

    tr.

      N

    "

  • 8/16/2019 MAD Master Lab Manual (Final)

    44/131

      Threadslee#(*488)

      O

      ath(Ee#tion e)

      N

      O

      O

      O

    O

    ""

  • 8/16/2019 MAD Master Lab Manual (Final)

    45/131

    OUTPUT)

    "

  • 8/16/2019 MAD Master Lab Manual (Final)

    46/131

    E24er15en! ) Crea!e a MIDP a44713a!1"n >h13h h"> !" !he 8er -&; 81 8e!1"n. A77

    8e!1"n ha9e , 4"1b7e "4!1"n an% "ne r1gh! "4!1"n e2a3!7. A44713a!1"n 3"8n! an% h"> !" !he

    8er h"> 5an r1gh! an>er >ere r1gh! an% h"> !he5 !" 8er.

     

    Obe3!19e) %'le to understand J2ME features

    O8!3"5e) nowledge a'out the MI!let lass and For"s

    A7g"r1!h5

    te#7*7777I"#ort the #akages needed to run the MI!let and i"#le"ents the interfae needed

    te#727777!elare the varia'les needed in the MI!let

    te#70777 tart the life .le of MI!let

    te#717777Write the "ethods re9uired

    start%##()/#ause%##()/destro.%##()

    te#74777 5ive the "enu ite"s re9uired

    te#767777elet the given hoie

    te#7;7777%nswer the 9uestion

    te#7

  • 8/16/2019 MAD Master Lab Manual (Final)

    47/131

    F7">3har!

    "&

  • 8/16/2019 MAD Master Lab Manual (Final)

    48/131

    Pr"gra5)

    i"#ort Cava"iroedition"idlet

    i"#ort Cava"iroeditionldui

    i"#ort Cava"iroeditionr"s

    i"#ort Cavaio

     #u'li lass Vui:Midlet etends MI!let i"#le"ents +o""andListener N

      #u'li For" for"*

      #u'li For" for"2

      #u'li For" for"0

      #u'li For" for"1

      #u'li For" for"4

      #u'li For" for"6

      #u'li For" for";

      #u'li +hoie5rou# h*

      #u'li +hoie5rou# h2

      #u'li +hoie5rou# h0

      #u'li +hoie5rou# h1

      #u'li +hoie5rou# h4

      #u'li +o""and net+o""and

      #u'li +o""and 'ak+o""and

      #u'li +o""and Menu+o""and

      #u'li +o""and Ak+o""and

      #u'li +o""and Eit+o""and

      #u'li +o""and s+o""and

      #u'li !is#la. dis#la.

    "#

  • 8/16/2019 MAD Master Lab Manual (Final)

    49/131

      #u'li tringIte" st

      #u'li TetField tetfield

      #u'li int ount

      #u'li Beordtore reordstorePnull

      #u'li BeordEnu"eration rePnull

      #u'li %lert alert

      #u'li +o"#are o"#

      #u'li tringIte" st*

      #u'li Vui:Midlet()

      N

      ountP8

      dis#la.P!is#la.get!is#la.(this)

      net+o""andPnew +o""and(Q$etQ/+o""andA/*)

      'ak+o""andPnew +o""and(QakQ/+o""and%+/*)

      Ak+o""andPnew +o""and(QaveQ/+o""and+BEE$/*)

      Eit+o""andPnew +o""and(QEitQ/+o""and+BEE$/*)

      s+o""andPnew +o""and(QTo#oresQ/+o""and+BEE$/*)

      stPnew tringIte"(QTotal3ointsQ/Q8Q)

      st*Pnew tringIte"(QQ/QQ)

      tetfieldPnew TetField(QEnter$a"eQ/QQ/28/TetField%$@)

      for"*Pnew For"(QJ2ME tands forQ)

      for"2Pnew For"(Qa'PQ)

      for"0Pnew For"(Q44Q)

      for"1Pnew For"(QWho is %3 +MQ)

      for"4Pnew For"(QHow "an. !istrits in %3Q)

      for"6Pnew For"(QoreQ)

      for";Pnew For"(QTo# oreersQ)

    "%

  • 8/16/2019 MAD Master Lab Manual (Final)

    50/131

      h*Pnew +hoie5rou#(QQ/+hoieER+LISE)

      h*a##end(QJava 2 Mo'ile EditionQ/ null)

      h*a##end(QJava 2 Maro EditionQ/ null)

      h*a##end(QJava 2 Miro EditionQ/ null)

      h*a##end(QJava 2 Musi EditionQ/ null)

      for"*a##end(h*)

      for"*add+o""and(net+o""and)

      for"*set+o""andListener(this)

     

    h2Pnew +hoie5rou#(QQ/+hoieER+LISE)

      h2a##end(Q'aQ/ null)

      h2a##end(Q'aQ/ null)

      h2a##end(Q'DaQ/ null)

      h2a##end(Q'7aQ/ null)

      for"2a##end(h2)

      for"2add+o""and(net+o""and)

      for"2add+o""and('ak+o""and)

      for"2set+o""andListener(this)

     

    h0Pnew +hoie5rou#(QQ/+hoieER+LISE)

      h0a##end(Q28Q/ null)

      h0a##end(Q08Q/ null)

      h0a##end(Q*8Q/ null)

      h0a##end(Q24Q/ null)

      for"0a##end(h0)

      for"0add+o""and(net+o""and)

    '

  • 8/16/2019 MAD Master Lab Manual (Final)

    51/131

      for"0add+o""and('ak+o""and)

      for"0set+o""andListener(this)

     

    h1Pnew +hoie5rou#(QQ/+hoieER+LISE)

      h1a##end(QBosiahQ/ null)

      h1a##end(QJaganQ/ null)

      h1a##end(Q+handaa'uQ/ null)

      h1a##end(QiranQ/ null)

      for"1a##end(h1)

      for"1add+o""and(net+o""and)

      for"1add+o""and('ak+o""and)

      for"1set+o""andListener(this)

     

    h4Pnew +hoie5rou#(QQ/+hoieER+LISE)

      h4a##end(Q

  • 8/16/2019 MAD Master Lab Manual (Final)

    52/131

      for";set+o""andListener(this)

      tr.

      N

      reordstorePBeordtoreo#enBeordtore(QVui:Q/ true)

      O

      ath(Ee#tion e)

      N

      O

      O

      #u'li void start%##() N

      dis#la.set+urrent(for"*)

      O

      #u'li void #ause%##() N

      O

      #u'li void destro.%##('oolean unonditional) N

      O

      #u'li void o""and%tion(+o""and "d/!is#la.a'le dis#la.a'le)

      N

      if(dis#la.a'lePPfor"*)

      N

      if("dPPnet+o""and)

      dis#la.set+urrent(for"2)

    2

  • 8/16/2019 MAD Master Lab Manual (Final)

    53/131

      O

     else if(dis#la.a'lePPfor"2)

      N

      if("dPPnet+o""and)

      dis#la.set+urrent(for"0)

      else if("dPP'ak+o""and)

      dis#la.set+urrent(for"*)

     O

      else if(dis#la.a'lePPfor"0)

      N

      if("dPPnet+o""and)

      dis#la.set+urrent(for"1)

      else if("dPP'ak+o""and)

      dis#la.set+urrent(for"2)

     O

      else if(dis#la.a'lePPfor"1)

      N

      if("dPPnet+o""and)

      dis#la.set+urrent(for"4)

      else if("dPP'ak+o""and)

      dis#la.set+urrent(for"0)

     O

      else if(dis#la.a'lePPfor"4)

      N

      if("dPPnet+o""and)

      N

  • 8/16/2019 MAD Master Lab Manual (Final)

    54/131

      if(h*geteletedInde()PP2)

      ount

      if(h2geteletedInde()PP8)

      ount

      if(h0geteletedInde()PP0)

      ount

      if(h1geteletedInde()PP0)

      ount

      if(h4geteletedInde()PP0)

      ount

      stsetTet(tringvalueAf(ount))

     

    for"6a##end(st)

      for"6a##end(tetfield)

      dis#la.set+urrent(for"6)

      O

    else if("dPP'ak+o""and)

      dis#la.set+urrent(for"1)

     O

     else if(dis#la.a'lePPfor"6)

      N

      if("dPPAk+o""and)

      N

      tr.

      N

    "

  • 8/16/2019 MAD Master Lab Manual (Final)

    55/131

      tring 3na"ePtetfieldgettring()

      int 3ointsPInteger#arseInt(stgetTet())

      '.te=> '.tes

      .te%rra.Aut#uttrea" ostrea"Pnew .te%rra.Aut#uttrea"()

      !ataAut#uttrea" dstrea" Pnew !ataAut#uttrea"(ostrea")

      dstrea"writeTF(3na"e)

      dstrea"writeInt(3oints)

      dstrea"flush()

      '.tesPostrea"to.te%rra.()

      reordstoreaddBeord('.tes/ 8/'.teslength )

      ostrea"reset()

      ostrea"lose()

      dstrea"lose()

      alert Pnew %lert(QMessageQ/QavedQ/null/%lertT.#eI$FA)

      alertsetTi"eout(%lertFABESEB)

      dis#la.set+urrent(alert)

      O

      ath(Ee#tion e)

      N

      alert Pnew %lert(QMessageQ/etotring()/null/%lertT.#eI$FA)

      alertsetTi"eout(%lertFABESEB)

      dis#la.set+urrent(alert)

      O

     

    O

     else if("dPPEit+o""and)

      N

  • 8/16/2019 MAD Master Lab Manual (Final)

    56/131

      tr.

      N

      reordstoreloseBeordtore()

      notif.!estro.ed()

      O

      ath(Ee#tion e)

      N

     

    O

      O

      else if("dPPs+o""and)

      N

      tr.

      N

      '.te=> '.tesPnew '.te=088>

      .te%rra.In#uttrea" 'strea"Pnew .te%rra.In#uttrea"('.tes)

      !ataIn#uttrea" dstrea"Pnew !ataIn#uttrea"('strea")

      tringuffer s'Pnew tringuffer()

      o"#Pnew +o"#are()

      rePreordstoreenu"erateBeords(null/ o"#/false)

    st*setTet(QQ)

      while(rehas$etEle"ent())

      N

      reordstoregetBeord(renetBeordId()/ '.tes/ 8)

      s'a##end(dstrea"readTF()QQdstrea"readInt())

      s'a##end(QKnQ)

      dstrea"reset()

    $

  • 8/16/2019 MAD Master Lab Manual (Final)

    57/131

      O

      'strea"lose()

      dstrea"lose()

     

    st*setTet(s'totring())

      for";a##end(st*)

      O

      ath(Ee#tion e)

      N

      alert Pnew %lert(QMsgQ/etotring()/null/%lertT.#eI$FA)

      alertsetTi"eout(%lertFABESEB)

      dis#la.set+urrent(alert)

      O

      dis#la.set+urrent(for";)

      O

     O

     else if(dis#la.a'lePPfor";)

      N

      if("dPP'ak+o""and)

      dis#la.set+urrent(for"6)

     O

      O

    O

    lass +o"#are i"#le"ents Beord+o"#arator 

    N

    &

  • 8/16/2019 MAD Master Lab Manual (Final)

    58/131

      #u'li '.te=> '.tedataPnew '.te=088>

      #u'li .te%rra.In#uttrea" 'strea"Pnull

      #u'li !ataIn#uttrea" dstrea"Pnull

      #u'li int o"#are('.te=> r*/'.te=> r2)

      N

      int r*int/r2int

      int orP8

      tr.

      N

      int "alenPMath"a(r*length/ r2length)

      if("alen'.tedatalength)

      N

      '.tedataPnew '.te="alen>

      O

      'strea"Pnew .te%rra.In#uttrea"(r*)

      dstrea"Pnew !ataIn#uttrea"('strea")

      dstrea"readTF()

      r*intPdstrea"readInt()

      'strea"Pnew .te%rra.In#uttrea"(r2)

      dstrea"Pnew !ataIn#uttrea"('strea")

      dstrea"readTF()

      r2intPdstrea"readInt()

      if(r*intPPr2int)

      N

      orP Beord+o"#aratorEVIS%LE$T

      O

    #

  • 8/16/2019 MAD Master Lab Manual (Final)

    59/131

      else if(r*intr2int)

      N

      orP Beord+o"#arator3BE+E!E

      O

      else if(r*intUr2int)

      N

      orP Beord+o"#aratorFALLAW

      O

      return or

      O

      ath(Ee#tion e)

      N

      return Beord+o"#aratorEVIS%LE$T

      O

      O

      #u'li void o"#are+lose()

      N

      tr.

      N

      if('strea"XPnull)

      N

      'strea"lose()

      O

      if(dstrea"XPnull)

      N

      dstrea"lose()

    %

  • 8/16/2019 MAD Master Lab Manual (Final)

    60/131

      O

      O

      ath(Ee#tion e)

      N

      O

      O

    O

    $'

  • 8/16/2019 MAD Master Lab Manual (Final)

    61/131

    OUTPUT)

    $!

  • 8/16/2019 MAD Master Lab Manual (Final)

    62/131

    E24er15en! /)Crea!e a MIDP a44713a!1"n >h13h E2a51ne !ha! a 4h"ne n85ber>h13h a 8er

    en!ere% 1n g19en #"r5a!.

    Obe3!19e) %'le to understand J2ME features

    O8!3"5e) nowledge a'out the MI!let lass and For"s

    A7g"r1!h5

    te#7*7777I"#ort the #akages needed to run the MI!let and i"#le"ents the interfae needed

    te#727777!elare the varia'les needed in the MI!let

    te#70777 tart the life .le of MI!let

    te#717777Write the "ethods re9uired

    start%##()/#ause%##()/destro.%##()

    te#74777 Enter the #hone nu"'er 

    te#767777if the for"at is orret then dis#la. A 

    te#7;7777if not then dis#la. WBA$5

    $2

  • 8/16/2019 MAD Master Lab Manual (Final)

    63/131

    F7">3har!

    $

  • 8/16/2019 MAD Master Lab Manual (Final)

    64/131

    Pr"gra5)

    i"#ort Cava"iroedition"idlet

    i"#ort Cava"iroeditionldui

     #u'li lass In#ut+heking etends MI!let i"#le"ents +o""andListener N

      #u'li For" for"*

      #u'li TetField tetfield*

      #u'li +o""and eit+o""and

      #u'li +o""and ok+o""and

      #u'li tringIte" st

      #u'li !is#la. dis#la.

      #u'li In#ut+heking()

      N

      dis#la.P!is#la.get!is#la.(this)

      for"*Pnew For"(QInsert the 3hone nu"'erQ)

      eit+o""andPnew +o""and(QEitQ/+o""andERIT/*)

      ok+o""andPnew +o""and(QAkQ/+o""andA/*)

      stPnew tringIte"(Q3hone $u"'er is Q/QQ)

      tetfield*Pnew TetField(Q3honeQ/QQ/08/TetField%$@)

      for"*a##end(tetfield*)

      for"*add+o""and(ok+o""and)

      for"*add+o""and(eit+o""and)

      for"*set+o""andListener(this)

    $"

  • 8/16/2019 MAD Master Lab Manual (Final)

    65/131

      O

      #u'li void start%##() N

      dis#la.set+urrent(for"*)

      O

      #u'li void #ause%##() N

      O

      #u'li void destro.%##('oolean unonditional) N

      O

      #u'li void o""and%tion(+o""and "d/!is#la.a'le dis#la.a'le)

      N

      if("dPPeit+o""and)

      notif.!estro.ed()

      else if("dPPok+o""and)

      N

      tring sPtetfield*gettring()

      sPsre#lae(Y Y/ YY)

     

    int lenPslength()

      int iP8

      int P8

      tring s*PQQ

      while(iUlen)

      N

    $

  • 8/16/2019 MAD Master Lab Manual (Final)

    66/131

      if(shar%t(i)PPYY)

      N

     

    if(PP8)

      N

     

    if(s*e9uals(Q818Q) s*e9uals(Q81*Q) s*e9uals(Q848Q) s*e9uals(Q8188Q) s*e9uals(Q811Q))

      N

     

     

    s*PQQ

      O

      O

      if(PP*)

      N

     

    if(s*length()7*PP0)

      N

     

      s*PQQ

      O

     O

      O

      s*Ps*shar%t(i)

      i

    $$

  • 8/16/2019 MAD Master Lab Manual (Final)

    67/131

      O

      if(s*length()7*PP0 s*length()7*PP1 s*length()7*PP4)

     

     

    if(PP0)

      stsetTet(QAQ)

      else

      N

      stsetTet(QwrongKn 3hone $u"'er For"at is Kn%rea ode "ust 'e 81884881*

    8188811Q)

      O

      for"*a##end(st)

     O

      O

    O

    $&

  • 8/16/2019 MAD Master Lab Manual (Final)

    68/131

    OUTPUT)

     

    $#

  • 8/16/2019 MAD Master Lab Manual (Final)

    69/131

    E24er15en! 0) Crea!e a MIDP a44713a!1"n >h13h %ra> a bar gra4h !" !he %147a. Da!a 9a78e

    3an be g19en a! 1n! arra.

     

    Obe3!19e) %'le to understand J2ME features

    O8!3"5e) nowledge a'out the MI!let lass and For"s

    A7g"r1!h5)-

    te#7*777 I"#ort the #akages needed to run the MI!let and i"#le"ents the interfae needed

    te#727777!elare the varia'les needed in the MI!let

    te#7077777tart the life .le of MI!let

    te#7177777Write the "ethods re9uired

    start%##()/#ause%##()/destro.%##()

    te#747777 5ive the "enu ite"s re9uired

    te#7677777tart the life .le

    te#7;77777%dd the "enu to the e"ulator 

    $%

  • 8/16/2019 MAD Master Lab Manual (Final)

    70/131

    F7">3har!

    &'

  • 8/16/2019 MAD Master Lab Manual (Final)

    71/131

    Pr"gra5)

    i"#ort Cava"iroedition"idlet

    i"#ort Cava"iroeditionldui

     #u'li lass ar5ra#hMI!let etends MI!let i"#le"ents +o""andListenerN

      #u'li For" for"

      #u'li +o""and eit+o""and

      #u'li +o""and Ak+o""and

      #u'li +o""and 'ak+o""and

      #u'li !is#la.a'le d

      #u'li !is#la. dis#la.

      #u'li TetField tetfield*

      #u'li TetField tetfield2

      #u'li TetField tetfield0

      #u'li TetField tetfield1

      #u'li TetField tetfield4

      #u'li ar5ra#hMI!let()

      N

      dis#la.P!is#la.get!is#la.(this)

      for"Pnew For"(Qar5ra#hQ)

      tetfield*Pnew TetField(QSalue*G7Q/QQ/08/TetField%$@)

      tetfield2Pnew TetField(QSalue2G7Q/QQ/08/TetField%$@)

      tetfield0Pnew TetField(QSalue0G7Q/QQ/08/TetField%$@)

      tetfield1Pnew TetField(QSalue1G7Q/QQ/08/TetField%$@)

      tetfield4Pnew TetField(QSalue4G7Q/QQ/08/TetField%$@)

      for"a##end(tetfield*)

      for"a##end(tetfield2)

    &!

  • 8/16/2019 MAD Master Lab Manual (Final)

    72/131

      for"a##end(tetfield0)

      for"a##end(tetfield1)

      for"a##end(tetfield4)

      Ak+o""andPnew +o""and(QAkQ/+o""andA/*)

      eit+o""andPnew +o""and(QEitQ/+o""andERIT/*)

      'ak+o""andPnew +o""and(QakQ/+o""and%+/*)

      for"add+o""and(Ak+o""and)

      for"add+o""and(eit+o""and)

      for"set+o""andListener(this)

      O

      #u'li void start%##() N

      dis#la.set+urrent(for")

      O

      #u'li void #ause%##() N

      O

      #u'li void destro.%##('oolean unonditional) N

      O

      #u'li void o""and%tion(+o""and o""and/!is#la.a'le dis#la.a'le)

      N

      if(dis#la.a'lePPfor")

      N

      if(o""andPPAk+o""and)

      N

      int=> dataPnew int=4>

    &2

  • 8/16/2019 MAD Master Lab Manual (Final)

    73/131

      data=8>PInteger#arseInt(tetfield*gettring())

      data=*>PInteger#arseInt(tetfield2gettring())

      data=2>PInteger#arseInt(tetfield0gettring())

      data=0>PInteger#arseInt(tetfield1gettring())

      data=1>PInteger#arseInt(tetfield4gettring())

      dPnew ar+anvas(data)

      dadd+o""and('ak+o""and)

      dset+o""andListener(this)

      dis#la.set+urrent(d)

      O

      else if(o""andPPeit+o""and)

      notif.!estro.ed()

      O

      else if(dis#la.a'lePPd)

      N

      if(o""andPP'ak+o""and)

      dis#la.set+urrent(for")

      O

      O

    O

    lass ar+anvas etends +anvasN

      int=> data

      #u'li int

      #u'li int .

      #u'li int .*

    &

  • 8/16/2019 MAD Master Lab Manual (Final)

    74/131

      #u'li int h

      #u'li ar+anvas(int=> data)

      N

      thisdataPdata

      P*8

      O

     #u'li void #aint(5ra#his g)

      N

      gset+olor(244/ 244/ 244)

      gfillBet(8/ 8/ thisgetWidth()/ thisgetHeight())

      gset+olor(244/ *24/ *88)

      int iP8

      .*Pdata=8>

      hP288

      while(iUdatalength)

      N

      .Pdata=i>

      hP288.*7.

      gfillBet(/ ./24 / h)

     P08

      i

    O

    O

    O

    &"

  • 8/16/2019 MAD Master Lab Manual (Final)

    75/131

    OUTPUT)

    &

  • 8/16/2019 MAD Master Lab Manual (Final)

    76/131

    E24er15en! :)Crea!e a MIDP a44713a!1"n >h13h %ra> a 41e 3har! !" !he %147a. Da!a 9a78e 3an

    be g19en a! 1n! arra. Y"8 3an en!er #"8r %a!a

  • 8/16/2019 MAD Master Lab Manual (Final)

    77/131

    F7">3har!

    &&

  • 8/16/2019 MAD Master Lab Manual (Final)

    78/131

    Pr"gra5)

    i"#ort Cava"iroedition"idletMI!let

    i"#ort Cava"iroeditionldui

     #u'li lass 3ie+hartMI!let etends MI!let i"#le"ents +o""andListener N

      #u'li For" for"

      #u'li +o""and eit+o""and

      #u'li +o""and Ak+o""and

      #u'li !is#la. dis#la.

      #u'li TetField tetfield*

      #u'li TetField tetfield2

      #u'li TetField tetfield0

      #u'li TetField tetfield1

      #u'li TetField tetfield4

     #u'li !is#la.a'le d

      #u'li void start%##() N

      dis#la. P !is#la.get!is#la.(this)

      for"Pnew For"(Q!raw 3ieQ)

      tetfield*Pnew TetField(QSalue*G7Q/QQ/08/TetField%$@)

      tetfield2Pnew TetField(QSalue2G7Q/QQ/08/TetField%$@)

      tetfield0Pnew TetField(QSalue0G7Q/QQ/08/TetField%$@)

      tetfield1Pnew TetField(QSalue1G7Q/QQ/08/TetField%$@)

      tetfield4Pnew TetField(QSalue4G7Q/QQ/08/TetField%$@)

      for"a##end(tetfield*)

      for"a##end(tetfield2)

      for"a##end(tetfield0)

      for"a##end(tetfield1)

      for"a##end(tetfield4)

  • 8/16/2019 MAD Master Lab Manual (Final)

    79/131

      eit+o""and P new +o""and(QeitQ/ +o""andERIT/ *)

      Ak+o""andPnew +o""and(QAkQ/+o""andA/*)

      for"add+o""and(Ak+o""and)

      for"add+o""and(eit+o""and)

      for"set+o""andListener(this)

      dis#la.set+urrent(for")

      O

      #u'li void #ause%##() N

      O

      #u'li void destro.%##('oolean unonditional) N

      O

      #u'li void o""and%tion(+o""and / !is#la.a'le s) N

      if(sPPfor")

      N

      if(PPeit+o""and)

      notif.!estro.ed()

      else if(PPAk+o""and)

      N

      int=> data P new int=4>

      data=8>PInteger#arseInt(tetfield*gettring())

      data=*>PInteger#arseInt(tetfield2gettring())

      data=2>PInteger#arseInt(tetfield0gettring())

      data=0>PInteger#arseInt(tetfield1gettring())

      data=1>PInteger#arseInt(tetfield4gettring())

      d P new 3ie+hart+anvas(data)

      dadd+o""and(eit+o""and)

    &%

  • 8/16/2019 MAD Master Lab Manual (Final)

    80/131

      dset+o""andListener(this)

      dis#la.set+urrent(d)

      O

      O

     else if(sPPd)

      N

      if(PPeit+o""and)

      dis#la.set+urrent(for")

     O

      O

    O

    lass 3ie+hart+anvas etends +anvas N

      int=> data

      int olors=> P N 8FF8888/ 8%?E?6?/ 888FFFF/ 8+6;4E+/ 888

  • 8/16/2019 MAD Master Lab Manual (Final)

    81/131

      for (int i P 8 i U datalength i) N

      su" P data=i>

      O

      int delta%ngle P 068 *88 D su" D *88

      int P 1

      int . P 1

      int dia"eter

      if (width height)

      dia"eter P height 7 . 2

      else

      dia"eter P width 7 2

      int start%ngle P 8

      for (int i P 8 i U datalength i) N

      gset+olor(olors=i>)

      gfill%r(/ ./ dia"eter/ dia"eter/ start%ngle/ delta%ngle data=i>)

      start%ngle P delta%ngle data=i>

      O

    OO

    #!

  • 8/16/2019 MAD Master Lab Manual (Final)

    82/131

    OUTPUT)

    #2

  • 8/16/2019 MAD Master Lab Manual (Final)

    83/131

    E24er15en! &;) Th1 6*ME a547e 4r"gra5 h"> h"> !" %147a a 1547e LOGIN SCREEN "n

    !he 6*ME 4h"ne an% h"> !" a8!hen!13a!e !" a HTTP er9er. Man 6*ME a44713a!1"n #"r e38r1!

    rea"n re81re !he a8!hen!13a!1"n "# !he 8er. Th1 #ree 6*ME a547e 4r"gra5 h"> h"> a 6*ME

    a44713a!1"n 3an %" a8!hen!13a!1"n !" !he ba3(en% er9er.

     $oteG se %#ahe To"at erver as We' erver and M.s9l as !ata'ase erver

    Obe3!19e) %'le to understand J2ME features

    O8!3"5e) nowledge a'out the MI!let lass and Cs#

    A7g"r1!h5)-

    te#7*777+reate a !ata'ase

    te#72777Insert values into ta'le

    te#70777+reate Cs# file

    te#71777i"#ort all s9l #akages in Cs# file

    te#747777reate data in#ut strea"

    te#76777intialise the inde

    te#7;777Cd' onnetion ste#s

    te#7

  • 8/16/2019 MAD Master Lab Manual (Final)

    84/131

    F7">3har!

    #"

  • 8/16/2019 MAD Master Lab Manual (Final)

    85/131

    Pr"gra5)

    i"#ort Cava"iroedition"idlet

    i"#ort Cava"iroeditionldui

    i"#ort Cava"iroeditionio

    i"#ort Cavaio

     #u'li lass login etends MI!let i"#le"ents +o""andListener N

      #u'li For" for"*

      #u'li +o""and ok+o""and

      #u'li !is#la. dis#la.

      #u'li Htt#+onnetion htPnull

      #u'li In#uttrea" istPnull

      #u'li tringIte" st

      #u'li TetField t*

      #u'li TetField t2

      #u'li %lert alert

      #u'li For" for"2

      #u'li login()

      N

      dis#la.P!is#la.get!is#la.(this)

      stPnew tringIte"(Q Q/Q Welo"eQ)

      alert Pnew %lert(Q Q/QWrong ser$a"e or 3asswordQ/null/%lertT.#eI$FA)

      t*Pnew TetField(Qser$a"eQ/Q Q/08/TetField%$@)

      t2Pnew TetField(Q3asswordQ/Q Q/08/TetField3%WAB!)

      for"*Pnew For"(QLogin HereQ)

      for"2Pnew For"(QWelo"eQ)

      ok+o""andPnew +o""and(QLoginQ/+o""andA/*)

    #

  • 8/16/2019 MAD Master Lab Manual (Final)

    86/131

      for"*add+o""and(ok+o""and)

      for"*set+o""andListener(this)

     

    for"*a##end(t*)

      for"*a##end(t2)

      for"2a##end(st)

      O

      #u'li void start%##() N

      dis#la.set+urrent(for"*)

      O

      #u'li void #ause%##() N

      O

      #u'li void destro.%##('oolean unonditional) N

      notif.!estro.ed()

      O

      #u'li void o""and%tion(+o""and "d/!is#la.a'le d)

      N

      if("dPPok+o""and)

      N

      tr.

      N

     

    DD tring urlPQhtt#GDD*?2*6

  • 8/16/2019 MAD Master Lab Manual (Final)

    87/131

      DDhtP(Htt#+onnetion)+onnetoro#en(Qhtt#GDD*?2*6 'Pnew '.te=?88>

      istread(')

      tring sPnew tring(')

      sPstri"()

      if(se9uals(QokQ))

      dis#la.set+urrent(for"2)

      else

      N

      alertsetTi"eout(%lertFABESEB)

      dis#la.set+urrent(alert)

      O

    O

      ath(Ee#tion e)

      N

    for"*a##end(etotring())

      OOOO

    #&

  • 8/16/2019 MAD Master Lab Manual (Final)

    88/131

    OUTPUT)

     

    ##

  • 8/16/2019 MAD Master Lab Manual (Final)

    89/131

    E24er15en! &&) Crea!e a Da!agra5 Ser9er 4r"e3!

    Obe3!19e) %'le to understand !atagra" server #roCet

    O8!3"5e) nowledge a'out sokets

    A7g"r1!h5)

    *I"#ort the #akages needed to run the MI!let

    2delare the varia'les needed in the MI!let

    0tart the life .le of MI!let

    1Write the "ethods re9uired

    start%##()/#ause%##()/destro.%##()

    4reate server side #rogra" '. i"#le"enting the interfaes o""and listener/Bunna'le

    6delare the re9uired varia'les needed

    ; use start/ run/ s.nhroni:ed void run() "ethods

  • 8/16/2019 MAD Master Lab Manual (Final)

    90/131

    F7">3har!

    %'

  • 8/16/2019 MAD Master Lab Manual (Final)

    91/131

    Pr"gra5)

    i"#ort Cava"iroedition"idlet

    i"#ort Cava"iroeditionldui

    i"#ort Cava"iroeditionio

     #u'li lass !atagra"erver etends MI!let i"#le"ents +o""andListenerN

      #u'li For" for"*

      #u'li For" for"2

      #u'li +o""and start+o""and

      #u'li +o""and refresh+o""and

      #u'li +o""and eit+o""and

      #u'li !is#la. dis#la.

      #u'li tringIte" st

      #u'li !atagra"erver()

      N

      dis#la.P!is#la.get!is#la.(this)

      start+o""andPnew +o""and(QtartQ/+o""andA/*)

      refresh+o""andPnew +o""and(QBefreshQ/+o""andA/*)

      eit+o""andPnew +o""and(QEitQ/+o""andERIT/*)

      stPnew tringIte"(Q Q/Q Q)

      for"* Pnew For"(Q!ata5ra"serverQ)

      for"2Pnew For"(QBead. to reeive MessagesQ)

      for"*add+o""and(start+o""and)

      for"*set+o""andListener(this)

      for"2add+o""and(refresh+o""and)

      for"2add+o""and(eit+o""and)

      for"2set+o""andListener(this)

    %!

  • 8/16/2019 MAD Master Lab Manual (Final)

    92/131

      O

      #u'li void start%##() N

      dis#la.set+urrent(for"*)

      O

      #u'li void #ause%##() N

      O

      #u'li void destro.%##('oolean unonditional) N

      O

      #u'li void o""and%tion(+o""and "d/!is#la.a'le dis#la.a'le)

      N

      if(dis#la.a'lePPfor"*)

      N

      if("dPPstart+o""and)

      N

      tr. N

      !atagra"+onnetion dg P (!atagra"+onnetion)

      +onnetoro#en(Qdatagra"GDDG?88*Q)

      tr. N

      int si:e P *88

      !atagra" datagra" P dgnew!atagra"(si:e)

      dgreeive(datagra")

      for"2a##end(datagra"get!ata()totring())

      O finall. N

    %2

  • 8/16/2019 MAD Master Lab Manual (Final)

    93/131

      dglose()

      O

    O ath (Ee#tion )N

      #rinttakTrae()

    O

      dis#la.set+urrent(for"2)

      O

      O

     else if(dis#la.a'lePPfor"2)

      N

      if("dPPeit+o""and)

      N

      notif.!estro.ed()

      O

     else if("dPPrefresh+o""and)

      N

      stsetTet(Q Q)

     O

      O

      O

    O

    %

  • 8/16/2019 MAD Master Lab Manual (Final)

    94/131

    +lient

    i"#ort Cava"iroedition"idlet

    i"#ort Cava"iroeditionldui

    i"#ort Cava"iroeditionio

     #u'li lass !atagra"+lient etends MI!let i"#le"ents +o""andListenerN

      #u'li For" for"*

      #u'li !is#la. dis#la.

      #u'li TetField tetfield

      #u'li +o""and send+o""and

      #u'li !atagra"+lient()

      N

      dis#la.P!is#la.get!is#la.(this)

      for"*Pnew For"(Q!atagra" +lientQ)

      send+o""andPnew +o""and(QsendQ/+o""andA/*)

      tetfieldPnew TetField(QEnter TetQ/null/08/TetField%$@)

      for"*a##end(tetfield)

      for"*add+o""and(send+o""and)

      for"*set+o""andListener(this)

      O

      #u'li void start%##() N

      dis#la.set+urrent(for"*)

      O

      #u'li void #ause%##() N

      O

    %"

  • 8/16/2019 MAD Master Lab Manual (Final)

    95/131

      #u'li void destro.%##('oolean unonditional) N

      O

      #u'li void o""and%tion(+o""and "d/!is#la.a'le d)

      N

      if("dPPsend+o""and)

      N

      tr. N

      !atagra"+onnetion dg P (!atagra"+onnetion)

      +onnetoro#en(Qdatagra"GDDloalhostG?88*Q)

      tr. N

    while(true)

    N

      '.te=> #a.load P tetfieldgettring()get.tes()

      !atagra" datagra" P dgnew!atagra"(#a.load/ #a.loadlength)

      dgsend(datagra")

    O

      O finall. N

      dglose()

      O

    O ath (Ee#tion ) N

      #rinttakTrae()

    O

      O

      O

    O

    %

  • 8/16/2019 MAD Master Lab Manual (Final)

    96/131

    O8!48!

    ADDITIONAL PROGRAMS

    %$

  • 8/16/2019 MAD Master Lab Manual (Final)

    97/131

    E24er15en! &*) Crea!e a MIDP a44713a!1"n >h13h 3rea!e M8!ab7e I5age.

    Obe3!19e) %'le to understand J2ME features

    O8!3"5e) nowledge a'out the MI!let lass and For"s

    A7g"r1!h5)-

    te#7*777 I"#ort the #akages needed to run the MI!let and i"#le"ents the interfae needed

    te#727777!elare the varia'les needed in the MI!let

    te#7077777tart the life .le of MI!let

    te#7177777Write the "ethods re9uired

    start%##()/#ause%##()/destro.%##()

    te#747777 5ive the "enu ite"s re9uiredte#7677777tart the life .le

    te#7;77777!is#la. "uta'le i"age

    %&

  • 8/16/2019 MAD Master Lab Manual (Final)

    98/131

    F7">3har!

    %#

  • 8/16/2019 MAD Master Lab Manual (Final)

    99/131

    Pr"gra5)

    i"#ort Cava"iroedition"idlet

    i"#ort Cava"iroeditionldui

     #u'li lass Muta'leI"ageEa"#le etends MI!let

    N

     #rivate !is#la. dis#la.

     #rivate M.+anvas anvas

     #u'li Muta'leI"ageEa"#le()

    N

    dis#la.P!is#la.get!is#la.(this)

    anvasPnew M.+anvas(this)

    O

     #roteted void start%##()

    N

    dis#la.set+urrent(anvas)

    O

     #roteted void #ause%##()

    N

    O

     #roteted void destro.%##('oolean unonditional)

    N

    O

     #u'li void eitMI!let()

    N

    destro.%##(true)

    %%

  • 8/16/2019 MAD Master Lab Manual (Final)

    100/131

    notif.!estro.ed()

    O

    lass M.+anvas etends +anvas i"#le"ents +o""andListener 

    N

     #rivate +o""and eit

     #rivate Muta'leI"ageEa"#le "uta'leI"ageEa"#le

     #rivate I"age i"agePnull

     #u'li M.+anvas(Muta'leI"ageEa"#le "uta'leI"ageEa"#le)

    N

    this"uta'leI"ageEa"#leP"uta'leI"ageEa"#le

    eitPnew +o""and(QEitQ/+o""andERIT/*)

    add+o""and(eit)

    set+o""andListener(this)

    tr.

    N

    i"agePI"agereateI"age(;8/;8)

    5ra#his gra#hisPi"ageget5ra#his()

    gra#hisset+olor(244/8/8)

    gra#hisfill%r(*8/*8/68/48/*

  • 8/16/2019 MAD Master Lab Manual (Final)

    101/131

    O

    O

     #roteted void #aint(5ra#his gra#his)

    N

    if(i"ageXPnull)

    N

    gra#hisset+olor(244/244/244)

    gra#hisfillBet(8/8/getWidth()/getHeight())

    gra#hisdrawI"age(i"age/08/08/5ra#hisS+E$TEB5ra#hisH+E$TEB)

    O

    O

     #u'li void o""and%tion(+o""and o""and/!is#la.a'le dis#la.)

    N

    if(o""andPPeit)

    N

    "uta'leI"ageEa"#leeitMI!let()

    O

    O

    O

    O

    !'!

  • 8/16/2019 MAD Master Lab Manual (Final)

    102/131

    OUTPUT)

    !'2

  • 8/16/2019 MAD Master Lab Manual (Final)

    103/131

    E24er15en! &+) Crea!e a MIDP a44713a!1"n >h13h 3rea!e I558!ab7e I5age.

    Obe3!19e) %'le to understand J2ME features

    O8!3"5e) nowledge a'out the MI!let lass and For"s

    A7g"r1!h5)-

    te#7*777 I"#ort the #akages needed to run the MI!let and i"#le"ents the interfae needed

    te#727777!elare the varia'les needed in the MI!let

    te#7077777tart the life .le of MI!let

    te#7177777Write the "ethods re9uired

    start%##()/#ause%##()/destro.%##()

    te#747777 5ive the "enu ite"s re9uired

    te#7677777tart the life .le

    te#7;77777!is#la. i""uta'le i"age

    !'

  • 8/16/2019 MAD Master Lab Manual (Final)

    104/131

    F7">3har!)

    !'"

  • 8/16/2019 MAD Master Lab Manual (Final)

    105/131

    Pr"gra5)

    i"#ort Cava"iroedition"idlet

    i"#ort Cava"iroeditionldui

     #u'li lass I""uta'leI"age etends MI!let i"#le"ents +o""andListener 

    N

     #rivate !is#la. dis#la.

     #rivate For" for"

     #rivate +o""and eit

     #rivate I"age i"age

     #rivate I"ageIte" i"ageIte"

     #u'li I""uta'leI"age()

    N

    dis#la. P !is#la.get!is#la.(this)

    eitPnew +o""and(QEitQ/+o""andERIT/*)

    for"Pnew For"(QI""uta'le I"age Ea"#leQ)

    for"add+o""and(eit)

    for"set+o""andListener(this)

    tr.

    N

    i"agePI"agereateI"age(Q".i"age#ngQ)

    i"ageIte"Pnew I"ageIte"(null/i"age/I"ageIte"L%@AT$EWLI$EEFABE

    I"ageIte"L%@ATLEFTI"ageIte"L%@AT$EWLI$E%FTEB/QM. I"ageQ)

    for"a##end(i"ageIte")

    O

    ath(CavaioIAEe#tion error)

    !'

  • 8/16/2019 MAD Master Lab Manual (Final)

    106/131

    N

    %lert alert Pnew %lert(QErrorQ/Qannot load ".i"age#ngQ/null/null)

    alertsetTi"eout(%lertFABESEB)

    alertsetT.#e(%lertT.#eEBBAB)

    dis#la.set+urrent(alert)

    O

    O

     #u'li void start%##()

    N

    dis#la.set+urrent(for")

    O

     #u'li void #ause%##()

    N

    O

     #u'li void destro.%##('oolean unonditional)

    N

    O

     #u'li void o""and%tion(+o""and o""and/!is#la.a'le dis#la.a'le)

    N

    if(o""andPPeit)

    N

    destro.%##(false)

    notif.!estro.ed()

    O

    OO

    !'$

  • 8/16/2019 MAD Master Lab Manual (Final)

    107/131

    OUTPUT)

    !'&

  • 8/16/2019 MAD Master Lab Manual (Final)

    108/131

    E24er15en! &,) Crea!e a MIDP a44713a!1"n >h13h 3rea!e N"nIn!era3!19e Ga8ge.

    Obe3!19e) %'le to understand J2ME features

    O8!3"5e) nowledge a'out the MI!let lass and For"s

    A7g"r1!h5)-

    te#7*777 I"#ort the #akages needed to run the MI!let and i"#le"ents the interfae needed

    te#727777!elare the varia'les needed in the MI!let

    te#7077777tart the life .le of MI!let

    te#7177777Write the "ethods re9uired

    start%##()/#ause%##()/destro.%##()

    te#747777 5ive the "enu ite"s re9uired

    te#7677777tart the life .le

    te#7;77777!is#la. the #roess i"age

    !'#

  • 8/16/2019 MAD Master Lab Manual (Final)

    109/131

    F7">3har!

    !'%

  • 8/16/2019 MAD Master Lab Manual (Final)

    110/131

    Pr"gra5)

    i"#ort Cava"iroedition"idlet

    i"#ort Cava"iroeditionldui

     #u'li lass 5auge$onInterative etends MI!let i"#le"ents +o""andListener 

    N

     #u'li !is#la. dis#la.

     #rivate For" for"

     #rivate +o""and eit

     #rivate +o""and start

     #rivate 5auge gauge

     #rivate 'oolean isafeToEit

     #u'li 5auge$onInterative()

    N

    dis#la.P!is#la.get!is#la.(this)

    gaugePnew 5auge(Q3rogress TrakingQ/false/*88/8)

    eitP new +o""and(QEitQ/+o""andERIT/*)

    startP new +o""and(QtartQ/+o""and+BEE$/*)

    for"Pnew For"(Q Q)

    for"a##end(gauge)

    for"add+o""and(start)

    for"add+o""and(eit)

    for"set+o""andListener(this)

    isafeToEitPtrue

    O

     #u'li void start%##()

    !!'

  • 8/16/2019 MAD Master Lab Manual (Final)

    111/131

    N

    dis#la.set+urrent(for")

    O

     #u'li void #ause%##()

    N

    O

     #u'li void destro.%##('oolean un+onditional)throws MI!lettate+hangeEe#tion

    N

    if(Xun+onditional)

    N

    throw new MI!lettate+hangeEe#tion()

    O

    O

     #u'li void o""and%tion(+o""and o""and/!is#la.a'le dis#la.a'le)

    N

    if(o""andPPeit)

    N

    tr.

    N

    destro.%##(isafeToEit)

    notif.!estro.ed()

    O

    ath(MI!lettate+hangeEe#tion Error)

    N

    %lert alertPnew %lert(Qus.Q/Q#lease tr. againQ/null/%lertT.#eW%B$I$5)

    !!!

  • 8/16/2019 MAD Master Lab Manual (Final)

    112/131

    alertsetTi"eout(*488)

    dis#la.set+urrent(alert/for")

    O

    O

    else if(o""andPPstart)

    N

    for"re"ove+o""and(start)

    new Thread(new 5auge#dater())start()

    O

    O

    lass 5auge#dater i"#le"ents Bunna'le

    N

     5auge#dater()

    N

    O

     #u'li void run()

    N

    isafeToEitPfalse

    tr.

    N

    while(gaugegetSalue()UgaugegetMaSalue())

    N

    Threadslee#(*888)

    gaugesetSalue(gaugegetSalue() *)

    O

    !!2

  • 8/16/2019 MAD Master Lab Manual (Final)

    113/131

    isafeToEitPtrue

    gaugesetLa'el(Q#roess o"#letedQ)

    O

    ath(Interru#tedEe#tion Error)

    N

    throw new Bunti"eEe#tion (ErrorgetMessage())

    O

    O

    O

    O

    !!

  • 8/16/2019 MAD Master Lab Manual (Final)

    114/131

    OUTPUT)

    !!"

  • 8/16/2019 MAD Master Lab Manual (Final)

    115/131

    E24er15en! &) Crea!e a MIDP a44713a!1"n >h13h 3rea!e 1n!era3!19e ga8ge

    Obe3!19e) %'le to understand J2ME features

    O8!3"5e) nowledge a'out the MI!let lass and For"s

    A7g"r1!h5)-

    te#7*777 I"#ort the #akages needed to run the MI!let and i"#le"ents the interfae needed

    te#727777!elare the varia'les needed in the MI!let

    te#7077777tart the life .le of MI!let

    te#7177777Write the "ethods re9uired

    start%##()/#ause%##()/destro.%##()

    te#747777 5ive the "enu ite"s re9uired

    te#7677777tart the life .le

    te#7;77777!is#la. the #roess i"age

    !!

  • 8/16/2019 MAD Master Lab Manual (Final)

    116/131

    F7">3har!

    !!$

  • 8/16/2019 MAD Master Lab Manual (Final)

    117/131

    Pr"gra5)

    i"#ort Cava"iroedition"idletMI!let

    i"#ort Cava"iroeditionldui

     #u'li lass 5augeInterative etends MI!let i"#le"ents +o""andListener 

    N

     #u'li For" for"

      #u'li +o""and eit

      #u'li +o""and vote

      #u'li !is#la. dis#la.

      #u'li 5auge gauge

     #u'li 5augeInterative()

    N

      dis#la. P !is#la.get!is#la.(this)

    gaugePnew 5auge

    (Qrate this "ovieQ/true/4/*)

    eitPnew +o""and(QvoteQ/

    +o""andERIT/*)

    votePnew +o""and(QvoteQ/

    +o""and+BEE$/*)

    for"Pnew For"(,-)

    for"add+o""and(eit)

    for"add+o""and(vote)

    for"a##end(gauge)

    for"set+o""andListener(this)

    !!&

  • 8/16/2019 MAD Master Lab Manual (Final)

    118/131

    O

     #u'li void start%##()

    N

    dis#la.set+urrent(for")

    O

     #u'li void #ause%##()

    N

    O

     #u'li void destro.%##('oolean

    unonditional)

    N

    O

     #u'li void o""and%tion(+o""and o""and/!is#la.a'le dis#la.a'le)

    N

    if(o""andPPeit)

    N

    destro.%##(false)

    notif.!estro.ed()

    O

    else if(o""andPPvote)

    N

    tring "sgP

    tringvalueAf(gaugegetSalue())

    %lert alertPnew %lert(QBankingQ/"sg/null/null)

    !!#

  • 8/16/2019 MAD Master Lab Manual (Final)

    119/131

    alertsetTi"eout(%lertFABESEB)

    alertsetT.#e(%lertT.#eI$FA)

    dis#la.set+urrent(alert)

    OO

    O

    !!%

  • 8/16/2019 MAD Master Lab Manual (Final)

    120/131

    OUTPUT)

    !2'

  • 8/16/2019 MAD Master Lab Manual (Final)

    121/131

    !2!

  • 8/16/2019 MAD Master Lab Manual (Final)

    122/131

    !22

  • 8/16/2019 MAD Master Lab Manual (Final)

    123/131

    OB6ECTIVE TYPE

    *) Whih of the following are J%! file attri'utes = >

      (%) MI!let7$a"e () MI!let7Sersion (+) MI!let7Sendor (!)%ll

    2) %t least 777777777777of non volatile "e"or. is neessar. to run MI! = >

    (%) *2< () *2

    (%)start%##()/ () init() (+) destro.() (!)%ll

    4) The 3!%3rofile is used with the------------ onfiguration = >

    (%)+L!+ () +!+ (+) 'oth %& (!) +3!+

    6) whih of the following lass is not su##orted '. J2ME = >

    (%)Tiker () Thread5rou# (+) Ite" (!) Teto

    ;) Whih of the following is a low level dis#la. = >

      (%) %lert () Teto (+) +anvas  (!) sreen

    (%) o""and () for" (+) anvas (!)%ll

    ?) The Ite" lass is derived fro" the 77777777777lass = >

    (%) anvas () reen (+) For" (!)%ll

    *8) The lass is used to sroll tet hori:ontall. on the sreen = >

    (%) +anvas () Tiker (+) !is#la. (!)roll

    !2

  • 8/16/2019 MAD Master Lab Manual (Final)

    124/131

    **) % #latfor"/ on whih develo#ers an 'uild and i"#le"ent #rogra"s to ontrol s"all o"#uting

    devies is alled  

    *2) % is front7end software that de#ends on 'ak7end software for "uh of the s.ste"

     #roessing

    *0) Etend +L!+  

    *1) +!+ devies use a  'it arhiteture

    *4= reates a "ahine ode i"age of an a##liation 'efore the a##liation is de#lo.ed on

    the s"all o"#uting devie

    *6) the +hoie5rou# lass is derived fro" the lass

    *;) Ever. gra#hi ontet has two harateristis ------------ and -----------

      *

  • 8/16/2019 MAD Master Lab Manual (Final)

    125/131

    %nswers

    *)! **) 6a9a * M13r" E%1!1"n

  • 8/16/2019 MAD Master Lab Manual (Final)

    126/131

    *) Whih of the following is true = >

     (%) BM #rovides data'ase funtionalit. () BM is not a relational data'ase

     (+) with BM we an[t interat with VL (!)%ll

    2) The 77777777777"ethod frees resoures used '. the i"#le"entation of the BeordFilter interfae one the

    searh is o"#leted = >

    (%) filter() () filter+lose() (+)dealoate() (!)free()

    0) The 77777777777777o'Cet is used whenever a J2ME a##liation needs to eeute a 9uer. i""ediatel.

    without first having the 9uer. o"#iled = >

     (%) tate"ent ( )3re#aredtate"ent (+) +alla'letate"ent (!) %ll

    1) Whih of the following of ee#tion thrown '. J!+ "ethods = >

    (%) VLEe#tion () VLWarning (+) !ataTrunation (!)%ll

    4) % 77777777777777777inde is reated '. using the +BE%TE I$!ER state"ent in a 9uer. without the use of 

    the $IVE "odifier = >

    (%) eondar. () lustered (+) 3ri"ar. (!) %ll

    6) whih of the following is o""uniations #rotool = >

    (%)HTT3 () FT3 (+) oket (!) %ll

    ;) Whih of the following are VL data t.#es = >

      (%) +LA () !%TE (+) %BB%@  (!) %ll

    (%) set3rotool() () #rotool() (+) get3rotool() (!)none

    ?) Whih of the following "ethod return t.#e is Besultet = >

    !2$

  • 8/16/2019 MAD Master Lab Manual (Final)

    127/131

    (%) eeute() ()eeuteVuer.() (+) eeute#date() (!)%ll

    *8) %n 7777777 join inludes rows of either ta'le that don[t have a "athing value = >

    (%) inner () e9ual(+) outer (!)all

    **) J2ME a##liations "ust store infor"ation in non7volatile "e"or. using the  

    *2) % is a olletion of reords organi:ed as rows (reords) and olu"ns (fields)

    *0) The interfae is used when searhing for a reord

    *1) J$!I stands   

    *4= The  returns a +onnetion interfae that is used throughout the #roess to referene the

    data'ase

    *6) The J!+ driver is loaded '. alling the "ethod

    *;) 9l t.#e for i"age is  

    *

  • 8/16/2019 MAD Master Lab Manual (Final)

    128/131

    %nswers

    *)! **) Beord Manage"ent .ste" (BM)

    2) *2) reord store

    0)% *0) BeordFilter  

    1)! *1) Java $a"ing and !iretor. Interfae

    4)% *4) !riverManagerget+onnetion()

    6)! *6) +lassfor$a"e()

    ;)! *;) LA

  • 8/16/2019 MAD Master Lab Manual (Final)

    129/131

    BEFEBE$+E

    * wwwallCntuworldin

    2 www5a%7aborgD#i7abD#i7ab#df 

    0 htt#sGDDwwwandroid#ito"Da##Dedusur.a5a%7ab

    1 "agrietainD##tDC2"e\287ab#df

    4 wwwC'ieteduinDDitDMAD\28LAB\28MANUALS\28!%@\28IB%$#df

    !2%

  • 8/16/2019 MAD Master Lab Manual (Final)

    130/131

    S!8%en! L1!

    IV.B.Te3h

  • 8/16/2019 MAD Master Lab Manual (Final)

    131/131

    1? *0B**%*24* S%$5ETI $IH%BI% BE!!@

    48 *0B**%*242 SITT% 3B%!EE3 BE!!@

    4* *0B**%*240 @E$!BI IL3%

    42 *2B**%*21? 3%S%$

    40 *2B**%*2*< 5!B J%I3%L BE!!@

    41 *2B**%*202 SI$A!%