Danh mục

Introduction to Java: 1-Abstract Window Toolkit Overview

Số trang: 19      Loại file: pdf      Dung lượng: 468.97 KB      Lượt xem: 10      Lượt tải: 0    
Thư viện của tui

Phí tải xuống: 18,000 VND Tải xuống file đầy đủ (19 trang) 0
Xem trước 2 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Trong nhiều năm, các lập trình đã đi qua những phức tạp của phần mềm portingtừ BSD dựa trên UNIX cho Hệ thống V Release 4 dựa trên UNIX, từ OpenWindows đểMotif, từ máy tính đến UNIX cho Macintosh (hoặc kết hợp một số tài khoản đó), vàgiữa các lựa chọn thay thế khác nhau, quá nhiều để đề cập đến. Bắt một ứng dụngđể làm việc được chỉ là một phần của vấn đề; bạn cũng đã đến cổng nó để tất cả các nền tảngbạn hỗ trợ, thường mất nhiều thời gian hơn các nỗ lực phát triểnchính...
Nội dung trích xuất từ tài liệu:
Introduction to Java: 1-Abstract Window Toolkit Overview In this chapter: • Components • Peers • Layouts 1 • Containers • And the Rest • Summary Abstract Window Toolkit OverviewFor years, programmers have had to go through the hassles of porting softwarefrom BSD-based UNIX to System V Release 4–based UNIX, from OpenWindows toMotif, from PC to UNIX to Macintosh (or some combination thereof), andbetween various other alternatives, too numerous to mention. Getting an applica-tion to work was only part of the problem; you also had to port it to all the plat-forms you supported, which often took more time than the development effortitself. In the UNIX world, standards like POSIX and X made it easier to move appli-cations between different UNIX platforms. But they only solved part of the prob-lem and didn’t provide any help with the PC world. Portability became even moreimportant as the Internet grew. The goal was clear: wouldn’t it be great if youcould just move applications between different operating environments withoutworrying about the software breaking because of a different operating system, win-dowing environment, or internal data representation?In the spring of 1995, Sun Microsystems announced Java, which claimed to solvethis dilemma. What started out as a dancing penguin (or Star Trek communicator)named Duke on remote controls for interactive television has become a newparadigm for programming on the Internet. With Java, you can create a programon one platform and deliver the compilation output (byte-codes/class files) toevery other supported environment without recompiling or worrying about thelocal windowing environment, word size, or byte order. The first generation of Javaprograms consisted mostly of fancy animation applets that ran in a web browserlike Netscape Navigator, Internet Explorer, or HotJava. We’re beginning to see thenext generation now: powerful distributed applications in areas ranging from com-merce to medical imaging to network management. All of these applicationsrequire extreme portability: Joe’s Online Bait Shop doesn’t have the time or 12 CHAPTER 1: ABSTRACT WINDOW TOOLKIT OVERVIEWenergy to port its “Online Bait Buyer” program to every platform on the Internetbut doesn’t want to limit its market to a specific platform. Java neatly solves theirproblem.Windowing systems present the biggest challenges for portability. When you movean application from Windows to the Macintosh, you may be able to salvage most ofthe computational guts, but you’ll have to rewrite the window interface code com-pletely. In Java, this part of the portability challenge is addressed by a packagecalled AWT, which stands for Abstract Window Toolkit (although people havecome up with many other expansions). AWT provides the magic of maintainingthe local look and feel of the user’s environment. Because of AWT, the same appli-cation program can look appropriate in any environment. For example, if yourprogram uses a pull-down list, that list will look like a Windows list when you runthe program under Windows; a Macintosh list when you run the program on aMac; and a Motif list when you run the program on a UNIX system under Motif.The same code works on all platforms. In addition to providing a common set ofuser interface components, AWT provides facilities for manipulating images andgenerating graphics.This book is a complete programmer’s guide and reference to the java.awt pack-age (including java.awt.image, java.awt.event, java.awt.datatransfer, andjava.awt.peer). It assumes that you’re already familiar with the Java language andclass libraries. If you aren’t, Exploring Java, by Pat Niemeyer and Josh Peck, pro-vides a general introduction, and other books in the O’Reilly Java series providedetailed references and tutorials on specific topics. This chapter provides a quickoverview of AWT: it introduces you to the various GUI elements contained withinthe java.awt package and gives you pointers to the chapters that provide morespecific information about each component. If you’re interested in some of themore advanced image manipulation capabilities, head right to Chapter 12, ImageProcessing. The book ends with a reference section that summarizes what you needto know about every class in AWT.In using this book, you should be aware that it covers two versions of AWT: 1.0.2and 1.1. The Java 1.1 JDK ( Java Developer’s Kit) occurred in December 1996. Thisrelease includes many improvements and additions to AWT and is a major step for-ward in Java’s overall functionality. It would be nice if I could say, “Forget about1.0.2, it’s obsole ...

Tài liệu được xem nhiều: