版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、<p> 附件1:外文資料翻譯譯文</p><p><b> 圖形用戶接口</b></p><p> 一個基本的設(shè)計方針是“簡單的事情變得容易,困難的事情成為可能。 ”</p><p> 勞在Java的圖形用戶界面(GUI)庫原設(shè)計目標是允許程序員建立一個GUI ,在所有平臺上看起來好。這一目標沒有實現(xiàn)。相反,Java的羅湖
2、抽象窗口工具包(AWT )產(chǎn)生一個GUI,看著所有系統(tǒng)上同樣表現(xiàn)平平。此外,它是限制性的,你可以用四種字體,你不能訪問任何更復雜的GUI元素,在你的操作系統(tǒng)存在。也尷尬和非面向?qū)ο蟮腏ava 1.0 AWT編程模型。一個學生在我的一個研討會(曾在Sun公司一直在創(chuàng)造Java的)解釋原因:原來的AWT已經(jīng)構(gòu)思,設(shè)計,并在一個月內(nèi)實施。一定的生產(chǎn)力的奇跡,也是為什么設(shè)計對象的教訓是非常重要的。</p><p> J
3、ava 1.1 AWT的事件模型,這需要一個更清晰的,面向?qū)ο蟮姆椒ǖ腏avaBeans組件的編程模型是面向可視化編程環(huán)境容易創(chuàng)造此外,情況有所好轉(zhuǎn)。的Java 2( JDK 1.2 ) ,基本上取代Java基礎(chǔ)類(JFC) ,被稱為GUI部分的所有“搖擺完成了轉(zhuǎn)型?!睆呐f的Java 1.0 AWT的這是一個易于使用的一整套豐富,易于理解的JavaBeans ,可以拖動和下降(以及手工編程) ,以建立一個合理的GUI 。 “第三次修訂版
4、”的軟件產(chǎn)業(yè)規(guī)則(一個產(chǎn)品是不是良好,直到第三次修訂版) ,似乎與編程語言也是如此。</p><p> 本章介紹了現(xiàn)代的Java Swing庫,使得Swing是Sun公司的最終目的地的GUI庫,為Java.2合理的假設(shè),如果你有一些原因,因為你支持舊的代碼,你需要使用原有的“老”的AWT (或瀏覽器的限制) ,你可以找到介紹,在這本書的第一版在www.MindView.net下載。請注意,一些AWT組件保持在J
5、ava中,并在某些情況下,你必須使用他們。</p><p> 請注意,這是不是所有的Swing組件或描述類的所有方法的綜合詞匯。你在這里看到的是一個簡單的介紹。 Swing庫是巨大的,本章的目的是只讓你的要領(lǐng)和舒適的概念開始。如果你需要做的比你在這里看到,那么Swing可以可能會給你想要的東西,如果你愿意做研究。</p><p> 在這里,我假設(shè)您已經(jīng)下載并安裝JDK文檔從http:/
6、/java.sun.com和瀏覽該文件的javax.swing類Swing庫的全部細節(jié)和方法。您也可以在網(wǎng)上搜索,但最好的地方開始,是Sun公司自己的Swing教程http://java.sun.com/docs/books/tutorial/uiswing~~V</p><p> 有許多(而厚)專門到Swing的書,你要到那些如果您需要更深入,或者如果你想修改默認的Swing行為。正如你關(guān)于Swing學習,
7、你會發(fā)現(xiàn):</p><p> 1.Swing是一個大為改善的編程模型相比,許多其他語言和開發(fā)環(huán)境(不認為它是完美的,但前進道路上的一個步驟) 。 JavaBeans的朝著結(jié)束本章介紹該庫的框架。</p><p> 2.“ GUI構(gòu)建器” (可視化編程環(huán)境)是一個平常的一個完整的Java開發(fā)環(huán)境方面。 JavaBeans和Swing的GUI生成器為你寫的代碼,你使用圖形化工具的形式放置到
8、組件。 </p><p> 因為Swing是相當簡單,即使你使用GUI構(gòu)建器,而不是通過手工編碼,生成的代碼仍然應(yīng)該理解。這解決了一個大問題,從過去,這很容易產(chǎn)生不可讀的代碼的GUI建設(shè)者。</p><p> :秋千包含所有組件,您會看到在一個現(xiàn)代的UI :一切從樹木和表包含圖片按鈕。這是大的一個圖書館,但它在手頭的任務(wù)適當?shù)膹碗s性;如果事情是簡單的,你不要不有寫很多代碼,但作為
9、你嘗試做更復雜的事情,你的代碼變得比例更復雜。</p><p> 你會喜歡關(guān)于Swing的大部分可能被稱為“正交使用。 ”也就是說,一旦你拿起對圖書館的總體思路,你通常可以申請他們無處不在。這主要是因為標準的命名約定,當我在寫這些例子,我通??梢圆聹y成功的方法名。這當然是一個好的庫設(shè)計的標志。此外,您通常可以插入到其他組件和事物的組成部分,將正常工作。</p><p> 鍵盤導航是自動
10、的,可以不使用鼠標的情況下運行的Swing應(yīng)用程序,這并不需要任何額外的編程。滾動支持是毫不費力;你只是包裹在一個JScrollPane組件,你把它添加到您的表單。如工具提示功能,通常需要使用一個單一的代碼行。</p><p> 可移植性, Swing是完全用Java編寫的。 Swing也支持一個相當激進的功能,稱為“可插拔的外觀和感覺, ”這意味著用戶界面的外觀,可以動態(tài)改變,以適應(yīng)不同的平臺和操作
11、系統(tǒng)下工作的用戶的期望。它甚至有可能(雖然很難)發(fā)明自己的外觀和感覺。你可以找到這些Web.3</p><p> 盡管所有的積極方面, Swing是并不適合每一個人,也沒有解決所有的用戶界面,其設(shè)計意圖的問題。在本章的結(jié)尾,我們來看看兩個備選方案擺動: IBM贊助的SWT的Eclipse編輯器,但可以作為一個開放源碼的,獨立的GUI庫,以及Macromedia的Flash客戶端開發(fā)的Flex工具開發(fā)端前端Web
12、應(yīng)用程序。</p><p><b> 小程序</b></p><p> 當Java第一次出現(xiàn),各地語言的騷動來自applet,一個方案,可以在互聯(lián)網(wǎng)上傳遞到運行在Web瀏覽器(里面所謂的沙箱,出于安全考慮) 。人們預見到,在互聯(lián)網(wǎng)發(fā)展的下一階段的Java applet ,許多基于Java的原書認為你在語言感興趣的原因是,你想要寫的applet 。</p>
13、;<p> 由于種種原因,這場革命從未發(fā)生過。一個問題的很大一部分是大多數(shù)機器不包括必要的Java軟件運行Applet ,下載并安裝了10 MB的包是不是大多數(shù)用戶愿意為了運行的東西,你隨便在網(wǎng)絡(luò)上遇到做。許多用戶甚至害怕的想法。作為一個客戶端應(yīng)用交付系統(tǒng)的Java Applet從來沒有達到臨界質(zhì)量,雖然你仍然會偶爾看到一個applet ,它們一般都被轉(zhuǎn)移到計算的死水。</p><p> 這并不
14、意味著applet是不是一個有趣的和有價值的技術(shù)。如果你在一個情況下,你可以確保用戶安裝了JRE (如企業(yè)環(huán)境內(nèi)) ,然后小程序(或的JNLP / Java Web Start的,在本章稍后描述)可能是最完美的方式來分發(fā)客戶端程序沒有通常的成本和努力,分發(fā)和安裝新的軟件,并自動更新每個人的機器。你會發(fā)現(xiàn)一個在網(wǎng)上補充這本書在www.MindView.net applet的技術(shù)引進。</p><p> 附件2:
15、外文原文(復印件)</p><p> Graphical User </p><p> Interfaces </p><p> A fundamental design guideline is "Make simple things easy, and difficult things possible."</p><
16、;p> The original design goal of the graphical user interface (GUI) library in Java l.o was to allow the programmer to build a GUI that looks good on all platforms. That goal was not achieved. Instead, the Java l.o Ab
17、stract Windowing Toolkit (AWT) produced a GUI that looked equally mediocre on all systems. In addition, it was restrictive; you could use only four fonts and you couldn’t access any of the more sophisticated GUI elements
18、 that exist in your operating system. The Java 1.0 AWT programming m</p><p> The situation improved with the Java 1.1 AWT event model, which takes a much clearer, object-oriented approach, along with the ad
19、dition of JavaBeans, a component programming model that is oriented toward the easy creation of visual programming environments. Java 2 (JDK 1.2) finished the transformation away from the old Java 1.0 AWT by essentially
20、replacing everything with the Java Foundation Classes (JFC), the GUI portion of which is called "Swing." These are a rich set of easy-to-use, easy-to-u</p><p> This chapter introduces the modern J
21、ava Swing library and makes the reasonable assumption that Swing is Sun’s final destination GUI library for Java.2 If for some reason you need to use the original "old" AWT (because you’re supporting old code o
22、r you have browser limitations), you can find that introduction in the 1st edition of this book, downloadable at www.MindView.net. Note that some AWT components remain in Java, and in some situations you must use them. &
23、lt;/p><p> Please be aware that this is not a comprehensive glossary of either all the Swing components or all the methods for the described classes. What you see here is intended to be a simple introduction.
24、The Swing library is vast, and the goal of this chapter is only to get you started with the essentials and comfortable with the concepts. If you need to do more than what you see here, then Swing can probably give you wh
25、at you want if you’re willing to do the research. </p><p> I assume here that you have downloaded and installed the JDK documentation from http://java.sun.com and will browse the javax.swing classes in that
26、 documentation to see the full details and methods of the Swing library. You can also search the Web, but the best place to start is Sun’s own Swing Tutorial at http://java.sun.com/docs/books/tutorial/uiswing </p>
27、<p> There are numerous (rather thick) books dedicated solely to Swing, and you’ll want to go to those if you need more depth, or if you want to modify the default Swing behavior. </p><p> As you lea
28、rn about Swing, you’ll discover: </p><p> Swing is a much improved programming model compared to many other languages and development environments (not to suggest that it’s perfect, but a step forward on th
29、e path). JavaBeans (introduced toward the end of this chapter) is the framework for that library. </p><p> "GUI builders" (visual programming environments) are a de rigueur aspect of a complete Ja
30、va development environment. JavaBeans and Swing allow the GUI builder to write code for you as you place components onto forms using graphical tools. This rapidly speeds development during GUI building, and also allows f
31、or greater experimentation and thus the ability to try out more designs and presumably come up with better ones. </p><p> Because Swing is reasonably straightforward, even if you do use a GUI builder rather
32、 than coding by hand, the resulting code should still be comprehensible. This solves a big problem with GUI builders from the past, which could easily generate unreadable code. </p><p> Swing contains all t
33、he components that you expect to see in a modern UI: everything from buttons that contain pictures to trees and tables. It’s a big library, but it’s designed to have appropriate complexity for the task at hand; if someth
34、ing is simple, you don’t have to write much code, but as you try to do more complex things, your code becomes proportionally more complex. </p><p> Much of what you’ll like about Swing might be called "
35、;orthogonality of use." That is, once you pick up the general ideas about the library, you can usually apply them everywhere. Primarily because of the standard naming conventions, while I was writing these examples
36、I could usually guess successfully at the method names. This is certainly a hallmark of good library design. In addition, you can generally plug components into other components and things will work correctly. </p>
37、<p> Keyboard navigation is automatic; you can run a Swing application without using the mouse, and this doesn’t require any extra programming. Scrolling support is effortless; you simply wrap your component in a
38、 JScrollPane as you add it to your form. Features such as tool tips typically require a single line of code to use. </p><p> For portability, Swing is written entirely in Java. </p><p> Swing
39、also supports a rather radical feature called "pluggable look and feel," which means that the appearance of the UI can be dynamically changed to suit the expectations of users working under different platforms
40、and operating systems. It’s even possible (albeit difficult) to invent your own look and feel. You can find some of these on the Web.3 </p><p> Despite all of its positive aspects, Swing is not for everyone
41、 nor has it solved all the user interface problems that its designers intended. At the end of the chapter, we’ll look at two alternative solutions to Swing: the IBM-sponsored SWT, developed for the Eclipse editor but fre
42、ely available as an open-source, standalone GUI library, and Macromedia’s Flex tool for developing Flash client-side front ends for Web applications. </p><p><b> Applets </b></p><p>
43、; When Java first appeared, much of the brouhaha around the language came from the applet, a program that can be delivered across the Internet to run (inside a so-called sandbox, for security) in a Web browser. People f
44、oresaw the Java applet as the next stage in the evolution of the Internet, and many of the original books on Java assumed that the reason you were interested in the language was that you wanted to write applets. </p&g
45、t;<p> For various reasons, this revolution never happened. A large part of the problem was that most machines don’t include the necessary Java software to run applets, and downloading and installing a 10 MB pack
46、age in order to run something you’ve casually encountered on the Web is not something most users are willing to do. Many users are even frightened by the idea. Java applets as a client-side application delivery system ne
47、ver achieved critical mass, and although you will still occasionally see an</p><p> This doesn’t mean that applets are not an interesting and valuable technology. If you are in a situation where you can ens
48、ure that users have a JRE installed (such as inside a corporate environment), then applets (or JNLP/Java Web Start, described later in this chapter) might be the perfect way to distribute client programs and automaticall
49、y update everyone’s machine without the usual cost and effort of distributing and installing new software. </p><p> You’ll find an introduction to the technology of applets in the online supplements to this
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 眾賞文庫僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- java外文翻譯
- java外文翻譯---java和因特網(wǎng)
- java介紹外文翻譯
- java介紹外文翻譯
- java 編程外文翻譯
- java思想外文翻譯---java編程思想 (java和因特網(wǎng))
- java的基礎(chǔ)外文翻譯
- 外文翻譯---java學習過程
- 外文翻譯---java的思考
- java相關(guān)外文翻譯
- java外文文獻翻譯
- 外文翻譯--java技術(shù)介紹
- java io系統(tǒng)外文翻譯
- java io 系統(tǒng)外文翻譯
- java和因特網(wǎng)外文翻譯
- JAVA外文文獻+翻譯.doc
- java相關(guān)畢業(yè)論文外文翻譯
- 計算機專業(yè) java外文翻譯
- java介紹外文翻譯共15頁
- java思想外文翻譯畢業(yè)設(shè)計
評論
0/150
提交評論