0% found this document useful (0 votes)
2 views

Applets

Applets is a topic included in Java programming
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)
2 views

Applets

Applets is a topic included in Java programming
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
You are on page 1/ 5
ae APPLETS allan applet is (@ java program thot runs in a “browser, a Java class that ex applet -APplet _No maint ) “method - They are designed to be embedded “within. on btm Page. JVM 16 required #0 view an applet. It has strict security rules that are entorced 4¢ Mew-en by the Web browser. html file —__—_——> Browser \ me oppiet ~~ (Java embedded browser) LIFE CYCLE of applet: : init) —_|appiet initialized] 22s [arpret_ narnia] - applet (1056 ve present in jova-opplet Spielagi oy © scanned with OKEN Scanner _ import java-awt- * "public class APPainse extends Applet Public void main (araphics 9) i ee — g-drawstring C'Welcome to Applets”, 100, 100); F atl 3 "Compile + jovac ApPCIass- java > Open html file in jowa embedded web browser |__ ATL code: Applet- html CHTML> ETITLE> Applet Example St Title> |< applet code = “APP class. class * width= 400 heidht 4m V > se -opplet viewer command in command . prompt | > applet viewer = Apphtml-html > mention in java file jo /* éoppltt code + " AppClass. class” width “399° heiaht?® (i < /oppet s*7 i comple : >jovac AppClass. java Doapplet viewer Appclass- java © scanned with OKEN Scanner + pa wid” ‘nit )- used to Ini Halize " applet2 F Smoked only onee. (> public void start ()- -used to _ start the apple F savoked | adter Init) method or browser ie moximised. ed ed +0 stop - the applet. invoked “when applet 1 | eto pped or bro weer ie minimised. > > public void aectto4()- used to destroY the applet. Invoked only once. | Commonly used methods ot “doraphit s 1055: >) public abstract void drawstring (string str int sin Ww > used to draw me “specified string: | public void draw Rect Cink 2, int ¥, int width » ink heidhy) {| draws a ‘rectangle with the specified width & height. static void round R ect int %, int 4, Int width, int hei >| public 6 int "| avons a “rounded Rectangle with the _Sspecitie id width I height. > | public abstrod void sin RectCint w ‘nt int width, int height) > used 0 ) fill the , yectangle with default color & IL specified wid height : | | public abstract void | dromoailint % inky, iat wid, | |e a p_spediied width & height. at reign © scanned with OKEN Scanner —— lic * void drawtine (int 4, int Y uw a tnt my ME nt Ys) sew line ew me “points Gow) k Orns) i int heiont int startamale Int are “onole)_ | draws a civenlar or el eniPhical nye. aye. mr star angle , nt ore angle) [wed HM circular ov elliptical aye | public abstract wid Soet-eolor setColor (color &) used t change the Qraphics current color to the cpecified color. 7 ‘void setBackQround (color newfolor) | changes the background color of an applets widow. | void _set Foregvound ( color newColor) oi used to Set the Aoveground color. = lor can be- color bla ie 0 white, ue, oreen, magenta, ed, Yellow) cyan, ete | color get Background ( ) [ee hon ee settings tor. the bockground abt | cotor getfoveground() . 7 ; iS ‘obtains. foreground calor. . © scanned with OKEN Scanner 9. -set Color (Color- red) j ey draw String (welcome ” » 50,50); draw Line ( 0 , 30 , 200 300); Q. draw Rect ( 40 90,100» 30) 30)3 g. Fill Rect ( 40, 100, » 30) 30)5 | a -draw Ova) (4, 200, 30)30)5 | g-set Color (color-pink) 5 | g-KN0val (1401 200) 30,30)5 9 -drawAre (40, 150 130,30) 30,210); 9 gin Are (240) 160) 30130, 0)180); [3 3 rt Zapplet code= “Graphics Demo -class ” I width ="300" peight « “300” > 7 applttviewer Graphics Derm-java © scanned with OKEN Scanner

You might also like