Converting between applets and applications

application

Converting between applets and applicationsTo convert an Application to Applet: Create an HTML page with an applet tag to invoke the applet. Delete the main method. Alter the class header so that it extends Applet rather than Frame. Add the import for the library class Applet. Change the name of the constructor method from the name of the class to init. Add an invocation of a method to set the layout of widgets in the applet window.This is typically:setLayout(new BorderLayout());To convert a Applet to Application:Change the name of the init method to the name of the class. This is now the constructor method for the class. Delete the word void in the header for this method, since a constructor method has no return type. Alter the class header so that it extends Frame rather than Applet. Create a new method called main, with the header public static void main(String[] args).  This is now the constructor method should create a Frame object as an instance of the class. So, if the class is called MyClass, the main method should be:public static void main(String[] args){    MyClass f = new MyClass();    f.setSize(300, 200);    f.setVisible(true);}Delete the import for the class Applet, since it now redundant.Add a method windowClosing to handle the event which is the user clicking on the close window button. This also involves adding implements WindowListener and this.addWindowListener(this); in order to register the event handler.Add an invocation of a method to set the layout of widgets in the frame.This is typically:setLayout(new FlowLayout());Make sure that the applet does not use any of the methods that are special to the Applet class - methods including getAudioClip, getCodeBase, getDocumentBase, GetImage. 

时间: 2024-08-04 02:43:59

Converting between applets and applications的相关文章

【OH】Glossary Oracle词汇表(中)

Glossary [OH]Glossary Oracle词汇表(中) Oracle? Database Net Services Administrator's Guide 11g Release 2 (11.2) E41945-02 Glossary ● access control list (ACL) The group of access directives that you define. The directives grant levels of access to specif

【OH】Glossary Oracle词汇表(上)

Glossary [OH]Glossary Oracle词汇表(上) Oracle? Multimedia DICOM Developer's Guide 11g Release 2 (11.2) E10778-03 Glossary ● anonymity document An XML document that specifies the set of attributes to be made anonymous, and defines the actions required to

Java认证宝典v1.0之SCJD篇

Java认证宝典v1.0之SCJD篇Java认证宝典v1.0之SCJD篇(本文为www.java365.com原创,版权所有,转载请注明出处) 在J2EE尚未得到规模应用以前,SCJD是java认证中的高级认证.即便现在有了SCWCD.SCJA等认证,SCJD依然有其独特的魅力. 一.考试目标 Programming Assignment Objectives Write an application program using Java technology. The application

JDBC技术介绍

1. 介 绍 Java 许多开发者和用户都在寻找程Java序中访问数据库的便捷方法.由于是download 一个健壮,安全,易于使用的,易于理解且可以从网络中自动,C所以它成为开发数据库应用的一种良好的语言基础.它提供了,C+Smalltalk+,, BASIC, COBOL, and 4GLs的Java许多优点.许多公司已经开始在与DBMS的 连接方面做工作. Java 许多应DBMS用开发者都希望能够编写独立于特定的DBMS程序,而我们也相信一个独立于的DBMS接口将使得与各种各样连SQL接

Java Platform Standard Edition 8 Documentation

Oracle has two products that implement Java Platform Standard Edition (Java SE) 8: Java SE Development Kit (JDK) 8 and Java SE Runtime Environment (JRE) 8. JDK 8 is a superset of JRE 8, and contains everything that is in JRE 8, plus tools such as the

用J2EE开发WebService

I. 概要 基于XML的Web服务是参照B2B通信协作模式制定的新的规范.它提供了概念上和结构上的,适用于各种不同平台和产品的基础.现在,开发者可以利用J2EE技术来开发基于XML的Web服务.他们可以利用现存的J2EE技术来开发完整的,遵从XML标准的,能完全共通的WEB服务.无需重新设计或者构造现有的J2EE系统,开发人员就可以构建复杂的强大的Web服务应用.II. 介绍 Web服务是一种可以接收从Internet或者Intranet上的其它系统中传递过来的请求,轻量级的独立的通讯技术.这种

W3C 用于在 web 应用中处理文件的 API(W3C File API for representing file objects in web applications)

File API W3C Last Call Working Draft 12 September 2013 This Version: http://www.w3.org/TR/2013/WD-FileAPI-20130912/ Latest Published Version: http://www.w3.org/TR/FileAPI/ Latest Editor's Draft: http://dev.w3.org/2006/webapi/FileAPI/ Previous Version

转换到 StoryBoard 的发布说明(Converting to Storyboards Release Notes)

转换到 StoryBoard 的发布说明(Converting to Storyboards Release Notes) 太阳火神的美丽人生 (http://blog.csdn.net/opengl_es) 本文遵循"署名-非商业用途-保持一致"创作公用协议 转载请保留此句:太阳火神的美丽人生 -  本博客专注于 敏捷开发及移动和物联设备研究:iOS.Android.Html5.Arduino.pcDuino,否则,出自本博客的文章拒绝转载或再转载,谢谢合作. 转换到 StoryBo

An Overview of RMI Applications

application An Overview of RMI Applications RMI applications are often comprised of two separate programs: a server and a client. A typical server application creates some remote objects, makes references to them accessible, and waits for clients to