1 / 22

Java Applets

Java Applets. Introduction to Java Applet Programs. Applications are ___________________ programs executed with Java interpreter Applet is a small program can be placed on a ___________ will be executed by the web ____________ give web pages “___________ content”. Java Applets.

gianna gianna
Download Presentation

Java Applets

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Java Applets

  2. Introduction to Java Applet Programs • Applications are ___________________ programs • executed with Java interpreter • Applet is a small program • can be placed on a ___________ • will be executed by the web ____________ • give web pages “___________ content”

  3. Java Applets • Built using one of general definitions of applets • Applet class • JAapplet class • Java applets are usually __________ • Draw graphics in a defined screen area • Enable user interaction with ______ elements

  4. Java Applet Classes • Abstract Windowing Toolkit AWT • Earlier versions of Java • _________ class is one of the AWT components • Java Foundation Classes JFC • Extension to Java in 1997 • Has a collection of _______ components for enhanced GUIs • Swing component classes begin with ____

  5. Java Applets • Applets are Java programs that can be _______________ in HTML documents • To run an applet you must create a _______ file which references the applet • Ready to Program also will run an applet • When browser loads Web page containing applet • Applet _____________ into Web browser • begins execution • Can be tested using _____________ program

  6. Contrast Application with Applet

  7. Applet Declaration • Syntax (note difference from application declaration)public class ClassName extends JAapplet _______________ is an object that will be a subclass of JApplet

  8. Body of an Applet • Note there is no ______________ method in an applet • JApplet class provides other methods instead of a main method • First method executed is the _______________ method

  9. Applets • Applet • Program that runs in • appletviewer (test utility for applets) • Web browser (IE, Communicator) • Executes when HTML (________________________) document containing applet is opened • Applications run in command windows • Notes • Focus on fundamental programming concepts first • Explanations will come later

  10. Turns format on Turns the format off Applets and Web Pages – HTML • Applets embedded in a web page • Executed when web page loaded by browser • Web pages structured with HTML codes • HyperText Mark-up Language • Syntax<command> . . .</command>

  11. Applets and Web Pages – HTML • Embedding Java applets • Insert applet tags<APPLET></APPLET> • Call the specific applet by its __________ <APPLET CODE = "Whatever.class" WIDTH = nnn HEIGHT = mmmm><\APPLET> Where nnn and mmm are specific _______ sizes

  12. Applets and Web Pages – HTML • Create the web page code using a _______ editor • Save it with an .______ suffix • Open this file with appletviewer or with a _____ browser that supports Java • Java ________ must be installed (part of J2SDK 1.4.1 from Sun) <HTML> <HEAD> </HEAD> <BODY> <APPLET CODE = . . . > </APPLET> </BODY> </HTML>

  13. Applets and Web Pages – HTML • Client Web browser anywhere can access this web page from its host server • Embedded Java applet runs on ________________ (of any type platform) • This means a client anywhere on any type of platform can run a piece of software developed on any other type of platform Platform __________

  14. Thinking About Objects • Java an object-oriented language • However, Java has constructs from structured programming • Object orientation • Natural way to think about world and writing computer programs • Object-oriented programming models the real world • _______________ - properties of objects • Size, shape, color, weight, etc. • _______________ - actions that objects can perform • Aball rolls, bounces, inflates and deflates

  15. Thinking About Objects • Object orientation (continued) • _________________ • New classes of objects absorb characteristics of existing classes • ____________________ • Objects usually do not know how other objects are implemented • We can drive cars without knowing how every part works internally

  16. Thinking About Objects Class - unit of Java programming • Java focuses on _____________ (classes) • C focuses on verbs and is action oriented • Contain methods • Implement ___________________ • Contain _________________ • Implement attributes • Classes are reusable • Standardized, interchangeable parts

  17. A Simple Java Applet: Drawing a String • Figure 3.6 – a welcome message applet • The .html code to run the applet in a browser • The program output shown in the Applet Viewer <html> <applet code = "WelcomeApplet.class" width = "300" height = "45"> </applet> </html>

  18. Running the Applet • Compile • Use Ready to Program • If no errors, bytecodes stored in WelcomeApplet.class • We must create an HTML file • Loads the applet into appletviewer or a browser • Ends in .htm or .html • To execute an applet • Create an HTML file indicating which applet the browser (or appletviewer) should load and execute

  19. Running the Applet - Alternatively • Run from within Ready to Program • Prompt for applet window size appears • Applet window runs

  20. import allows us to use ____________ classes (allowing us to use applets and graphics, in this case). extends allows us to inherit the capabilities of class JApplet. Method ___________ is guaranteed to be called in all applets. Its first line must be defined as above.

  21. Running An Applet import java.applet.Applet; import java.awt.Graphics; public class HelloApplet extends Applet { public void paint (Graphics g) { g.drawString ("Hello. Welcome to",25,25); g.drawString ("Java Programming",25,40); } } • Enter this text into your Ready to Program editor • Compile the Java code

  22. Running An Applet • Now create an .html file to run the applet • Save it as HelloApplet.html • Make sure you save it in the same directory as the .java file <html> <applet code = "HelloApplet.class" width=275, height = 100> </applet> </html>

More Related

代做工资流水公司大连办入职流水北京企业贷流水图片沧州入职流水报价洛阳个人银行流水样本东莞开自存流水宜昌银行流水修改开具绵阳代开银行流水修改扬州薪资银行流水制作泰州制作入职流水绵阳工作收入证明多少钱衡阳流水单公司淄博制作工资证明廊坊工资证明打印绵阳代开薪资银行流水宁波查银行流水单徐州在职证明宁德自存流水图片深圳工资银行流水查询宜春代办自存流水泰州背调银行流水代办南宁薪资流水图片宿迁代做日常消费流水揭阳办工资银行流水荆州离职证明多少钱无锡银行流水修改制作商丘签证工资流水办理广州自存银行流水费用重庆工资流水办理舟山代开在职证明武汉背调流水香港通过《维护国家安全条例》两大学生合买彩票中奖一人不认账让美丽中国“从细节出发”19岁小伙救下5人后溺亡 多方发声卫健委通报少年有偿捐血浆16次猝死汪小菲曝离婚始末何赛飞追着代拍打雅江山火三名扑火人员牺牲系谣言男子被猫抓伤后确诊“猫抓病”周杰伦一审败诉网易中国拥有亿元资产的家庭达13.3万户315晚会后胖东来又人满为患了高校汽车撞人致3死16伤 司机系学生张家界的山上“长”满了韩国人?张立群任西安交通大学校长手机成瘾是影响睡眠质量重要因素网友洛杉矶偶遇贾玲“重生之我在北大当嫡校长”单亲妈妈陷入热恋 14岁儿子报警倪萍分享减重40斤方法杨倩无缘巴黎奥运考生莫言也上北大硕士复试名单了许家印被限制高消费奥巴马现身唐宁街 黑色着装引猜测专访95后高颜值猪保姆男孩8年未见母亲被告知被遗忘七年后宇文玥被薅头发捞上岸郑州一火锅店爆改成麻辣烫店西双版纳热带植物园回应蜉蝣大爆发沉迷短剧的人就像掉进了杀猪盘当地回应沈阳致3死车祸车主疑毒驾开除党籍5年后 原水城县长再被查凯特王妃现身!外出购物视频曝光初中生遭15人围殴自卫刺伤3人判无罪事业单位女子向同事水杯投不明物质男子被流浪猫绊倒 投喂者赔24万外国人感慨凌晨的中国很安全路边卖淀粉肠阿姨主动出示声明书胖东来员工每周单休无小长假王树国卸任西安交大校长 师生送别小米汽车超级工厂正式揭幕黑马情侣提车了妈妈回应孩子在校撞护栏坠楼校方回应护栏损坏小学生课间坠楼房客欠租失踪 房东直发愁专家建议不必谈骨泥色变老人退休金被冒领16年 金额超20万西藏招商引资投资者子女可当地高考特朗普无法缴纳4.54亿美元罚金浙江一高校内汽车冲撞行人 多人受伤

代做工资流水公司 XML地图 TXT地图 虚拟主机 SEO 网站制作 网站优化