0% found this document useful (0 votes)
10 views18 pages

Applets Unit5

The document discusses Java applets, which are small applications executed within web browsers and embedded in HTML pages. It explains the lifecycle of applets, their types (local and remote), and the methods used for their execution and interaction. Additionally, it covers how to pass parameters to applets and the limitations regarding their functionality and security.

Uploaded by

RamMohan Kanchi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
10 views18 pages

Applets Unit5

The document discusses Java applets, which are small applications executed within web browsers and embedded in HTML pages. It explains the lifecycle of applets, their types (local and remote), and the methods used for their execution and interaction. Additionally, it covers how to pass parameters to applets and the limitations regarding their functionality and security.

Uploaded by

RamMohan Kanchi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
[a | % . Arelsss. Ge Oo Aptek x Applets arce Srna Gana PrOyTaMA that axe. Prien tired tn WMeemek corm purtng’ — Apple: programs ase Eiecuzed by vain, the applet \tieroest (01) ONY weblrouosey tak Suppor8 Jawa —+An applet teprerenD Sata byte code. embedded in web page’ Applet = Jaua byee code + HTML page | Uses OF applets ¥ \ DE Suppor& to develop inkevinet bared (ov) voele based applications a De cas. pestforrn axtthemebtc Operations, disploy guopht ¢ play Soundriaccept Orert inpur, Create angmatfon and play Frrestackive- gornes" os An applet % a*reckanquiost avea” which can be used ark a Contarnes For obhest componenG’ uy Br can not be enectiked Andependenth: SB BW does noe yegpisred maint) method Lor erecersfon: fed Into two LYPer CTypes of — AppteS axe cars wm oO tu meso eR ee — 7 tocat Sea 2 Remoace applets + Locod applets, 1 . : a An apple aexetopet locals. and stor fa o tocar Berens 4S Krgron as a tocar applet | she Loco! applets dager SB SROLON SO Ane Mere page’ locad appler . ef [| Lk Por Loca applek theste fs no need OF nEEsinet =([= locat Cormpusert > Rergots. ogplek, x Remote appler %S that uokich is developed by some one etae and stoved on a vemote compukest , con to ee intesinet eB f oust systero connecked t© the tnpesimebs we. can jowntoa 3 athe Semote applet Onko Oust Sugtern NI ak the Tnteine® and une T Atexne® — € a ocad co ners fae re Celfent) PP (Seow 250) Loading 0 Remote apple 1 Drovdet to locate and load a Remote appleby use muy Know the applets addvers on the woeb, this address fs Known Od ORL (Uniform Rerouster Locator): ee Us hex a eS Keoshy (00) Appler Class Hevivarchy © Obsgece t Obdeck is the Subclasy Component fos BEY Class in Saum , Here vate abou PEESemr i Jevarlany conkafnest Appleh Class Package f. along with Progrony L J a \Wlendoto panne “rear ‘ * j | frame Apple t @ TRramne TApPLEE HOD. OpMbels iF Fer From agplicarfon, PO Re SESE, SOE. REASON ov | TERNS: PewEeN standorisl bone agisakons and apples PLOg ame +t JAVA prograrnmes ase wmaink4 Clossiffed into tuo Lonny: to ApeEcorions 4 Appicoxion- tohfch contains main(+) method And vohich axe exearted by Tova Antexprekest: WH APPLE 4 Which doernoke vegyrive maincy method and polich ame execitted in a uebbrousey Cor) applet \exoest tool: |*Eeae cxolotion eat Seen ‘Scanned wih CamScanner OSS a | Java souvice Peto G Sava) shave l Souoe (awa. compiles) 4 Byte code (dass ele) application ey applee Zo applet \teoext/ uebbrowser Y ourpue up Lc 7 lho catia also catted “client side” Tava programs —— appleld donot vse the maine) method fox inttating the ésecubion of the code when applets aste toadeds arkormatleay car cesitain method oF Applet class to Stasxt and erecurte the appler Code + ontike stand-alone applications applet cannot be pun independenk&y They ase WUAOF from tatde a week pag -e usted a spectat featuste Known OL HTML Page’ —> Apple® can not ead Fron (0%) uorite tO the Stter tn dhe locot compukert —> Apple eaN nok corMmunt{cake woth each othest Leswert i ‘ pon ane nekvoorh’ —> APPT CaN NOE BUN Ant PIOYTAN from the locad Cornputest: AU these vertxtctions and Urnitations ase | placed tH the Entexest OF Sectrsdty OF Stems there yextxteHion ensue that an apple® Cannot do anty AOMAQS to tne locod duygten: ‘Scanned wih CamScanner 3 « Seer fecig, "4 ® App TRS eygle has the Following Stakes I Bown on tnttiatinadion stake} Nero Born geo > Running stake g Idle State [Blocked Stake UW pead state /pextrory Stace 2 ante ©) passe 4 t kart ©) \ ueop y | destroy C > W) joilalteoxion ote. ‘r Apple entesr tne iniktabizatfon etare wohtch fe UH PiKSE Loaded THIS % achieved by CORLENG the UEC) MeENOd OF Applet clots" Grenestat forro of EO) method — pulotic. Uoid inte C 7 Akas mexhod | the fest jekhod to be carted by ade Icowsen and t U exearted Only One: Lo, he. PROGTAMUENeA CON Ure tit method to (nitfatiee Ons \tashatoter) creating | Ameeads eke: | cohen ete method execitton Completed, bowsest | took? fox the nede method Stave) ‘Scanned with CemScanner > Running stake. Apple entesu the BANning sxant ©) method of Applee claus: sor cate Lohen tne taytern carb tne aA . Grenenar fore oF stant C) merhod 4 —_—_— = —— publte void Stat C ) ~fnfa method “G cated afer snteEL) method and each xme appler H vevitiked by ihe Ubkest she Les har mainimieed the woebpage- +hak Cont Laint applet and moved to Anothest wo|elopage then thit macthod't crecution i topped vohen the Lest, Comes pack to ero the webpage again Skastk C) mekhod , crecutfon will Perumc’ Date, Od Stopped SEALS, 4 _ An Apple becomes Idle uchen te %S Stopped Recor Aeannlag Stopping OSCHIO arom abicattry when we close uns webpage COMEALIN HE. CHSLENKDY BUNNENg agree we can abo do nis by catting the SEOPC> method ex picky Grenestat foun of Stop ©) method public void Stop ¢ ) ‘Scanned wih CamScanner W Dead stare, BOE ® AO applek “S said to be dead cohen f & Semoved Prom mremor' w ANS occu akon ically by ANWOFing Coattingd the destroy () method then Woe Oyuite (loge) the broussest: DE Lhe applek had created any veroustcer LiKe athe destruc) method: Grenesian fou oF dextxoy ©) method 4 public Wold dextxouy 7) b a Note 4 None of tre aboue methods ase compubiory pore eek an apple’ LL skate Be = mover to the diplay ttate vohenewer Ge has pesforro Lome Ocepue Opestatfion on the Seseen: ee muse vortte paint (-) method to c¥eate an appar paine (£) method % defined tn the Applet class 5 coker W Jnnestiked Fror tne Component’ super hors oF Applet tees component tS Grenesax form Form, OF PAQEG) MEKMOD 41 bie Mold Pasne (Grroghice o é = oppler toa code 4 | | fe cycle method: Appler UP cycle contains EC), StaseC)) OPC) And demerorg ©) mexnods Begin FLLANTALLON Ctoad apple) Staxt ) stop) Diep! tary paint (-) Destroyed —>End Ect & lowwses Am applets State Hanieton diagrara’ Lome Example proqien) ap lifecyck be C for Progian See Yout Cera nokeboot ) > ‘Scanned wih CamScanner ae er © Creating pppletS © - = ——0 ns ” onich is Primarel q Smal) 2ava prggta Hn appler tS Used ia interne Computations ” , 4 Appets ase cxecurd by eitbet capplensicwe! (os) Fave -enabled Browset ” 4p dersop 2nd The Following Sheps ate Beavired Lrecure. he applets Cave fie) : an applet Code class file) (i). Building @. Coeating OF execurabl appler C- pyro (3). Pac pang Lapplesteg 059g apis Ham lwebPage - and P attach Jove Byte Cede With lappler Java Byte. code +4 HTML (oebPaye (y). Executing on Roney appler Program « (D. Belling GBP SSeS Ee To Build appler Code We Ui) Use tao Classes | Dpplek_ and Graphics — ———_ \ ‘Scanned with CemScanner ETE ——————_ Sava-appler Package « oN Appler i ples is @ predefined class Avaliabk in and be haviour to te appler Apple clas provides UF “Unrough iFS Methods such ab nit) , Stor?” Apple Programs doch nok Conkeun main(-) meted * Browser auromat Gly calls a Vohen an applee tS looded Serieh af Apple Clase methods “FOr Stating , bonnig and Stoppig “te appler Cade The Appr Class mainkai nb the ligecych F 90 applet - n i is Paint(-) 15 the method OF the Apple class , whe the sesuls OF the graphics ©) Sound - capper Coda on HE called , ik displays SCreen , The Ovutpyr me be rear, we wil) Pass the Graphics Class Obvecr to the anlar Poine(—) metre] G8 an onguenett (nraphies. class IS avaliable inte Package Javea (neneral form OF Paink(-) acted void Poin (Gyaphis 9) Public ‘Scanned wih CemScanner I | ‘Gencal forma 6% an appler cade is aé Follows Aa wD ~~ Ww impor Java «coke Ry , Jeva-qpplek + &* import Java: cipple ) Public class extends Appice { Public. Void peak (Crtaghie 3) { => [| Apel } ck Operakions Code * LEE § Enecuiabe ApPICE eee Es @. Create an as oe a \ & executable. aPPiek is noth) bok the + class file appler) rich 1s Obtoined by Compiling the Source Code obi of tre applet ” > Savec GipplerPiograrmname « Jove: 2 Sdavee Sample: «ove © Ak toi Genteratu — Sample-Class (Ryle cove)» fe a : ‘Scanned with CamScanner a = hl (2). Pre Pa wd Aavpleris tag In pre and ate aching Above class file wlth wis HO locloPase The. cypplics the Nane of the appler tag Suppl to be loaded and Eells browser Poe much Spac the apple Veet” Conkoiné Some athilood Cede , voidh> height a-- EK spec ibio , 7 Cod¢ _ The Value of Cede athibue of Zapple a sare eelass File Name which 'S tobe aitached ke specibl width The value OF oily abtriboe ct Zapplek 7 4 oa width of appler on Browse! * } Zaprek > © capk adryiboute of P : height TH value. OF eigh yet OD Bonk” Specibig yeighr of appl ee) "yoo"! eg — 4\ appld 7 ‘Scanned wih CamScanner i @ OS! yen, < Ei ecb Romig apple PIOqt"7. 5 . “~~~ enw 1 Use either browses To Execute. appler Program, we vil ©) appletviewer rook « ~> apple hwiewaes hrmepragiomname « heme @ one brine SapplerViwe” red OUEPEH * then we will get dex Example Progiary ie Jauaapplers4 Saveraor* * ? Apple a impor impor Public class Sample exknds £ public Vo id f g-diaaSaring weltome TO AP pesar( Coraphies 3) pew", 1) =), 5 Save tye above Program wilh the ame Sample: Java * ‘Scanned wih CamScanner ST > Davee. Sampe-Java a Jt voit generates Sample «Clas Preaie Ura webpage vel aticcl, Somme Clas Lapplee Code ="Sample- lass ! heignr= “Hoo! voidth =" S00" > Alappleh> | yam volth the aame one: hed / | Save the above PA Execorig © Ronn > applebviewes applet Program one sbtmt 2 welcore FO Applets * . ‘Scanned with CamScanner Wy “ese Ve Passing Pavamerers to Applets —F ————_— > i, & tag tay haa two attvibotes @naree. @ Value eg: © Lappler-- > ZPpayam names "ti? Value = ged < applet > @ Zappler > Zpavam name=" +," Vue = “Pam applet S Zlapplet > Passing Parameters to ao appler Code Using 2 Pavan > tog is Similod to Passing payameless to the maint-) method osing Command Line ayguments * getParomever’) 2- Je 15 the Pre-defined Method of _ Appler class> passe This setrives the valve Lom the Pavametes by tame * ‘Scanned wih CamScanner we WE Can Pass Pavameky Name ah argumen- to the geParameka(—) metiod IPorde! to ger tS vaive * a Se gehFenametes (« ey | \ { | i fnampke Program +0 demonistrate Pavameter Passig import Java-applet- #5 \ Java- aut: x" import Java aut *", Public class Sample extends Applet { public void paint (Crtaphics 9) { Stung $= gy favemces("P") , $= "Hor" 4 8 +" Howae gout" [Link] String (S, 10, $0) 3 [+ Zapper Code =* Sample -chss" height= "oo! vaidih= “500 > Zparary name 2" pl Velve = “Tova'! > Z| Param appl > a | Compilation \- Execution sans Soop eS > applenyieue! yaraple Java & Save Saarnple Jon ee Senge Ae pod Java, Howore you? ‘ \ 1 ‘Scanned wih CamScanner ©) Security issues in Applets oy — An appre is Smal) Joua Pprogrand vobich Can BC Primorjy Used in dorerner Computation’ which Can FE sun by eines web browser (os) appievicwet tools — applet = Tava Byte code + Wim documenH] One of the most imponent Fetvie og Tova 15 WS Secu - mode) * Bt allows untrusted Code, such a& apple downlocdeg Prom Various websites , to be 09 in Bearvicted Environment thal prevents thar code $107 doing cong thle malicious like deletiay gives (or) Send) fare mol » Pppler Security is implemented to Protect Users From UNK nowingly loadin Q malicious Progam that Can be hidden O10 webpog® * — fn applek Cannok load libraries (08) define Nati. methode — > J cannot Beod (01) brite Files On the hosk that's Executigg ir: ‘Scanned wih CamScanner >! Apples Cannok make Nerwotk Connections Excepr tO tre host frat ik Came 10m - > Applet Can nok Stair any PYogiam on the 0s that's Execoring ir: ~> Applet Can nok Bead Certain SyAtem properties” X x ‘Scanned wih CamScanner

You might also like