版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、外文原文The Java Abstract Windowing ToolkitFor the past five days you’ve concentrated on creating applets that do very simple things: display text, play an animation or a sound, or enable very basic interactions with the use
2、r. Once you get past that point, however, you may want to start creating more complex applets that behave like real applications, embedded in a Web page—applets that start to look like real GUI applications with buttons,
3、 menus, text fields and other elements of a real application.It’s this sort of real work in Java applets and applications that Java’s Abstract Windowing Toolkit, or AWT, was designed for. You’ve actually been using the A
4、WT all along, as you might have guessed from the classes you’ve been importing. The Applet class and most of the classes you’ve been using this week are all integral parts of the AWT. In fact, the HotJava browser is also
5、 written in Java and uses the AWT as well.The AWT provides the following:口 A full set of UI widgets and other components, including windows, menus, buttons, checkboxes, text fields, scrollbars, and scrolling lists口 Suppo
6、rt for UI “containers,” which can contain other embedded containers or UI widgets口 An event system for managing system and user events between and among parts of the AWT口 Mechanisms for laying out components in a way tha
7、t enables platform-independent UI designToday, you’ll learn about how to use all these things in your Java applets. Tomorrow, you’ll learn about creating windows, menus, and dialogs, which enable you to pop up separate w
8、indows from the browser window. In addition, you can use the AWT in stand-alone applications, so everything you’ve learned so far this week can still be used. If you find the framework of the Web browser too limiting, yo
9、u can take your AWT background and start writing full-fledged Java applications.Today, however, you’ll continue focusing on applets.Note: This is by far the most complex lesson so far. There’s a lot to cover and a lotof
10、code to go through today, so if it starts becoming overwhelming, you mightwant to take two days (or more) for this one.An AWT OverviewThe basic idea behind the AWT is that a Java window is a set of nested components, sta
11、rting from the outermost window all the way down to the smallest UI component. Components can class hierarchy that makes up the main classes in the AWT. The root of most of the AWT components is the class Component, whic
12、h provides basic display and event handling features. The classes Container, Canvas, TextComponent, and many of the other UI components inherit from Component. Inheriting from the Container class are objects that can con
13、tain other AWT components—the Panel and Window classes, in particular. Note that the java.applet.Applet class, even though it lives in its own package, inherits from Panel, so your applets are an integral part of the hie
14、rarchy of components in the AWT system.Figure 13.2.A partial AWT class hierarchy.A graphical user interface-based application that you write by using the AWT can be as complex as you like, with dozens of nested container
15、s and components inside each other. AWT was designed so that each component can play its part in the overall AWT system without needing to duplicate or keep track of the behavior of other parts in the system.The Basic Us
16、er Interface ComponentsThe simplest form of AWT component is the basic UI component. You can create and add these to your applet without needing to know anything about creating containers or panels—your applet, even befo
17、re you start painting and drawing and handling events, is already an AWT container.Because an applet is a container, you can put other AWT components—such as UIcomponents or other containers—into it.In this section, you’
18、ll learn about the basic UI components: labels, buttons, checkboxes, choice menus, and text fields. In each case, the procedure for creating the component is the same—you first create the component, and then add it to th
19、e panel that holds it, at which point it is displayed on the screen. To add a component to a panel (such as your applet, for example), use the add() method:public void init() {Button b = new Button(“OK”);add(b);}Componen
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 眾賞文庫僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- java工具包
- 計算機專業(yè) java外文翻譯
- 使用谷歌翻譯工具包
- java利用jxl工具包操作excel文件
- 計算機外文翻譯--java編程語言的介紹
- 計算機外文翻譯---java技術與ssh框架
- 計算機專業(yè)英語java介紹外文翻譯
- 計算機專業(yè)外文翻譯--計算機
- 計算機外文翻譯--菜單和工具欄
- 計算機外文翻譯---計算機引論
- 計算機科學與技術外文翻譯--詳細解析java中抽象類和接口的區(qū)別
- [雙語翻譯]--計算機外文翻譯---安全型java servlet的開發(fā)
- 招聘技術工具包
- 計算機畢業(yè)設計外文翻譯--現(xiàn)代并發(fā)抽象c#
- [雙語翻譯]計算機專業(yè)外文翻譯—云計算中的java web部署
- 工具winaircrackpack工具包使用介紹
- 計算機外文翻譯
- 計算機外文翻譯---j2me和java領域
- 計算機類外文文獻翻譯---java核心技術
- 黑客工具包大全
評論
0/150
提交評論