- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
java简明教程 chap12(java简明教程 chap12)
java简明教程 chap12(java简明教程 chap12)
The twelfth chapter drawing category - Graphics
Through the previous chapters of learning, we basically solved the command line programming problem. The program to turn to graphical mode is now started. The Graphics class provided by Java is a tool for drawing and displaying formatted text. The drawing must be done in a window (container), and the Java applet Applet is a window. In this chapter, we introduce the two basic functions of the Graphics class drawing, the basic graphics and the formatted text display. The rest of the content will be studied later.
12.1 write and draw in Applet
To create a Applet, you must allow your class to inherit from the java.allpet.Applet class. The Applet class is an abstract class that provides five abstract methods, they are:
Init () applet initialization, executed when applet was first created.
Start () applet starts to function properly. Called every time the applet screen is visible in the browser window, and is called after init ().
Stop () stop functioning. Whenever the applet screen moves out of the visible area of the browser window, the call is also called before destroy ().
Paint () writes and draws in the applet window or canvas. Is also called automatically in the update () method.
Destroy () discard an instance of the current applet. Called when applet reload from the web page.
The Graphics class is declared in the java.awt package. The name of AWT (Abstract, Windows, Toolskit) is the abstract window toolkit, the class library that provides the window and its components. Writing and drawing are implemented in Graphicss drawXXX method. Such as drawString (String), drawLine (...) and so on. The coordinate system used in drawing is the coordinate system in which the origin is in the upper left corner and the vertical axis is in pixels. As shown.
Heres a simple example of the basic method of writing and drawing in Applet.
Example 1. Basic method of writing and drawing in Applet.
X
Import ja
您可能关注的文档
- 24岁女工天天加管理班险致早产 想辞职就扣工资(24 year old female worker every day plus management class insurance premature birth, want to resign on deduction of wages).doc
- 25岁以后女孩怎样美容护肤(After 25 years old, how do the girls beauty skin care).doc
- 25水调歌头(25 Prelude To Water Melody).doc
- 25所最佳商学院的emba项目(EMBA project at the 25 best business schools).doc
- 28.2 物料入库信息查询(28.2 material storage information inquiry).doc
- 28万亩苹果成为农民致富靠山(280 thousand acres of apples become the patron of farmers).doc
- 28种粥(28 kinds of congee).doc
- 2oo9届全国大联考高三第一次联考·生物试卷及答案(2oo9 national high entrance exam the first three exam, biological papers and answers).doc
- 2、安全技术措施计划的项目总名称表(2. The general name list of safety technical measures plan).doc
- 2习题 第二章 热力学第二定律(2 exercises second chapter thermodynamics second laws).doc
原创力文档


文档评论(0)