APPENDIX a the Java API Packages

Total Page:16

File Type:pdf, Size:1020Kb

APPENDIX a the Java API Packages APPENDIX A The Java API Packages The JDK provides many packages (JDK 1.1 had 26 packages) and others are being developed (such as the 2D, 3D and Media packages). You must prefIx the names of the packages in Table A.I with "java.". TABLE A.1 The Java API packages PackaKe name Contents applet Applet related classes awt Platform-independent windowing classes awt.datatransfer Support for cut and paste style operations awt.event DeleKation event model classes awt.image Image manipulation classes awt.peer Native windowing facilities classes beans Beans facilities for developers io Input and output classes lang Basic Java classes lang. reflect Java reflection classes math BigDecimal and BigInteger classes net Java networking facilities rmi Remote method invocation classes rmi.dgc Distributed garbage collection rmi.registry Facilities for mapping names to remote objects rmi.server Facilities for the server side of RMI security Java Security for signed applets security.acl Access control list security. interfaces Digital Signature Algorithm interface specifIcations sql JDBC SQL interface classes text Internationalization facilities 428 Java and Object Orientation util General utili classes util.zip Java Archive (JAR) su ort classes For further information on these packages, see books such as Chan and Lee (1996) and Gosling and Yellin (1996). APPENDIXB The java.lang Package B.l INTRODUCTION The java. lang package contains the classes and interfaces which are the basis of the Java environment (as distinct from the Java language). For example, the class Obj ect (the root of all classes) is defined in this package. This package is automatically imported into every Java program (whether it is an application or an applet). The facilities provided by this package are, therefore, always available. Notice that the errors and exceptions generated directly by the Java Virtual Machine are defined in this package. Figure B.1 shows the classes and interfaces defined in this package and the relationships between them. A solid line indicates inheritance; a dashed line indicates an implementation; a rectangle indicates a class; and an oval indicates an interface. B.2 THE CLASSES The Obj ect class is the root of the class hierarchy. Every class has Obj ect as a superclass. All objects, including arrays, implement the methods of this class. Boolean The wrapper for the primitive type boolean. It provides methods for working with boolean values and converting boolean values to strings and vice versa. 429 430 Java and Object Orientation Byte final Serializable java.io Double final Float final Integer final Object Long final Short ( Cloneable final ( Runnable Error ThreadDeath Exception FIG. B.1 The java.lang package Character The wrapper for char values. It provides methods for manipulating and converting chars (e.g. from uppercase to lowercase). Class Instances represent classes and interfaces in a running Java application. Objects are constructed automatically by the Java Virtual Machine and by calls to the defineClass method in the class loader. ClassLoader An abstract class, of which subclasses extend the manner in which the Java Virtual Machine dynamically loads AppendixB 431 Compiler Support and related services for Java-to-native-code compilers. Math Many standard mathematical operations such as tan, cos, etc. To promote portability, the algorithms that implement the mathematical operations must match the output of algorithms available from the network library (netlib) package "Freely Distributable Math Library". Number An abstract class, which is the superclass of Byte, Double, Float, Integer, Long, and Short. Subclasses must provide methods to convert the represented numeric value to byte, double, float, int, long, and short. Byte The wrapper class for byte values. Double The wrapper class for double values. Float The wrapper class for float values. Integer The wrapper class for int values. Long The wrapper class for long values. Short The wrapper class for short values. Process Allows native operating system programs to be run via the exec command (or one of its variants). Run time Environment and system related functions such as garbage collection, tracing and library loading. Securi tyManager An abstract class that allows applications to implement their own security policy. String Character strings which cannot be changed. StringBuffer Sequences of characters which can be altered. The primary methods used with this class are insert and append. System A variety of utility methods such as standard input, standard output, and error output streams; access to externally defined properties; a way of loading fIles, libraries and interfaces to the Run time class. Thread Lightweight processes, called threads. A java program can have multiple, potentially interacting, threads. 432 Java and Object Orientation ThreadGroup An instance represents a group of threads that can be treated as a single entity. Throwable The root of all error or exception classes. Error Indicator of a serious problem in a program (programs are not expected to catch errors). ThreadDeath Although a subclass of Error, it is not really an error condition; it is generated when a thread terminates. You should only need to catch an instance of ThreadDeath if the program performs housekeeping (or similar) activities when a thread terminates. Exception The root class of all exception classes in Java. void An uninstantiable placeholder that references the primitive Java type void. B.3 THE INTERFACES Serializable Defines the common protocol for objects which can be saved to a file (defined in the java.io package, but implemented by many classes in this package). Cloneable Indicates that the implementing object can be cloned (i.e. you can copy this object field by field). Runnable Defines the common protocol for objects which expect to be run in their own thread. APPENDIXC The java.util Package C.l INTRODUCTION This package provides a variety of utility classes such as Date and Random, as well as the Vector and HashTable growable data structures. SeriaIizabIe ).. ..' • .,. ( java.lang ~:. >... ~,;;;,;.;.;.;;~ - - .... ' . .. ' ~:;;=;:~~ ( Enumeration ) ( EvenU.lstener ) TooManyUstenetlException ( OblefVef ) RuntimeException java.1ang FIG.C.l The java.util package 433 434 Java and Object Orientation C.2 THE CLASSES BitSet A growable index of bits (boolean values) which provides logical operators such as or and xor, as well as operations to set and reset bits in the set. Calendar Provides conversion functions between date objects and integer fields representing dates. Subclasses interpret a date according to the rules of a specific calendar system, for example GregorianCalendar. Date Represents a particular date and time. Dictionary An abstract superclass of classes which associate a key with a value (see Hashtable). EventObj ect The root for all event objects (for example, AWTEvnt). GregorianCalendar Implements the Gregorian calendar, with AD and BC dates. Hashtable Implements a traditional hashtable. Locale Represents a region (geographical, political or cultural). ResourceBundle Contains locale-specific objects which programs can load. The program code can be largely independent of the user's locale; most, if not all, of the locale-specific information is in the resource bundles. ListResourceBundle An abstract subclass of ResourceBundle which handles resources in a list oriented manner. PropertyResourceBundle An abstract subclass of ResourceBundle which handles resources using a set of static strings from a property fIle. Observable An abstract superclass of classes that can have observers associated with them and respond to the setChanged and notifyObservers methods. Properties Instances represent system (and user) properties, such as user name, etc. AppendixC 435 Random An instance generates a stream of pseudo-random numbers. TimeZone Instances represent time zones, such as GMT. SimpleTimeZone Defines a time zone for use with the Gregorian calendar class. Stack A basic stack type class, of which instances are growable. StringTokenizer Instances of this class allow a string to be broken down into tokens identified by delimiters (Le. space, period, etc.). Vector Implements a growable array of objects. C.3 THE INTERFACES Enumeration Instances which implement this interface generate a series of elements. Successive calls to the nextElement method return successive elements of the series. EventListener The root of all event listeners. Observer The common protocol for all classes which wish to take part in an observer-oberservable dependency relationship. C.4 THE EXCEPTIONS EmptyStackException Raised by the Stack class when asked to return a value from an empty stack. MissingResourceException Indicates that a resource is missing. NoSuchElementException Raised by a class implementing the Enumeration interface when the nextElement is sent and there are no remaining elements in the series. TooManyListenersException Thrown when only one listener may be registered on a particular event listener source, and more than one such registration is attempted. APPENDIXD The java.io Package D.1 INTRODualON ( DaIIlnput (:.:.j ( DaIIOulpui }..... \f--=-c--..,--J FIG. D.1 The java.io package 437 438 Java and Object Orientation The java.io package provides the basic input output facilities for the Java environment. Primarily this input output is built around the use of data streams. For example, to read data from a me, a stream is associated with that me and then the data in read from the stream. In general
Recommended publications
  • Java Programming Language, Java SE 6
    Java Programming Language, Java SE 6 Electronic Presentation SL-275-SE6 REV G.2 D61748GC11 Edition 1.1 Copyright © 2008, 2010, Oracle and/or its affiliates. All rights reserved. Disclaimer This document contains proprietary information, is provided under a license agreement containing restrictions on use and disclosure, and is protected by copyright and other intellectual property laws. You may copy and print this document solely for your own use in an Oracle training course. The document may not be modified or altered in any way. Except as expressly permitted in your license agreement or allowed by law, you may not use, share, download, upload, copy, print, display, perform, reproduce, publish, license, post, transmit, or distribute this document in whole or in part without the express authorization of Oracle. The information contained in this document is subject to change without notice. If you find any problems in the document, please report them in writing to: Oracle University, 500 Oracle Parkway, Redwood Shores, California 94065 USA. This document is not warranted to be error-free. Sun Microsystems, Inc. Disclaimer This training manual may include references to materials, offerings, or products that were previously offered by Sun Microsystems, Inc. Certain materials, offerings, services, or products may no longer be offered or provided. Oracle and its affiliates cannot be held responsible for any such references should they appear in the text provided. Restricted Rights Notice If this documentation is delivered to the U.S. Government or anyone using the documentation on behalf of the U.S. Government, the following notice is applicable: U.S.
    [Show full text]
  • 100% Pure Java Cookbook Use of Native Code
    100% Pure Java Cookbook Guidelines for achieving the 100% Pure Java Standard Revision 4.0 Sun Microsystems, Inc. 901 San Antonio Road Palo Alto, California 94303 USA Copyrights 2000 Sun Microsystems, Inc. All rights reserved. 901 San Antonio Road, Palo Alto, California 94043, U.S.A. This product and related documentation are protected by copyright and distributed under licenses restricting its use, copying, distribution, and decompilation. No part of this product or related documentation may be reproduced in any form by any means without prior written authorization of Sun and its licensors, if any. Restricted Rights Legend Use, duplication, or disclosure by the United States Government is subject to the restrictions set forth in DFARS 252.227-7013 (c)(1)(ii) and FAR 52.227-19. The product described in this manual may be protected by one or more U.S. patents, foreign patents, or pending applications. Trademarks Sun, the Sun logo, Sun Microsystems, Java, Java Compatible, 100% Pure Java, JavaStar, JavaPureCheck, JavaBeans, Java 2D, Solaris,Write Once, Run Anywhere, JDK, Java Development Kit Standard Edition, JDBC, JavaSpin, HotJava, The Network Is The Computer, and JavaStation are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and certain other countries. UNIX is a registered trademark in the United States and other countries, exclusively licensed through X/Open Company, Ltd. All other product names mentioned herein are the trademarks of their respective owners. Netscape and Netscape Navigator are trademarks of Netscape Communications Corporation in the United States and other countries. THIS PUBLICATION IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
    [Show full text]
  • Mac OS X for Java™ Geeks by Will Iverson
    [ Team LiB ] • Table of Contents • Index • Reviews • Reader Reviews • Errata Mac OS X for Java™ Geeks By Will Iverson Publisher : O'Reilly Pub Date : April 2003 ISBN : 0-596-00400-1 Pages : 296 Mac OS X for Java Geeks delivers a complete and detailed look at the Mac OS X platform, geared specifically at Java developers. Programmers using the 10.2 (Jaguar) release of Mac OS X, and the new JDK 1.4, have unprecedented new functionality available to them. Whether you are a Java newbie, working your way through Java Swing and classpath issues, or you are a Java guru, comfortable with digital media, reflection, and J2EE, this book will teach you how to get around on Mac OS X. You'll also get the latest information on how to build applications that run seamlessly, and identically, on Windows, Linux, Unix, and the Mac. [ Team LiB ] [ Team LiB ] • Table of Contents • Index • Reviews • Reader Reviews • Errata Mac OS X for Java™ Geeks By Will Iverson Publisher : O'Reilly Pub Date : April 2003 ISBN : 0-596-00400-1 Pages : 296 Copyright Preface Organization Conventions Used in This Book Comments and Questions Acknowledgments Chapter 1. Getting Oriented Section 1.1. All Those Confusing Names Section 1.2. Why Now? Chapter 2. Apple's Java Platform Section 2.1. Apple JVM Basics Section 2.2. Apple's JVM Directory Layout Section 2.3. Additional APIs and Services Section 2.4. Going Forward Chapter 3. Java Tools Section 3.1. Terminal Section 3.2. Code Editors Section 3.3. Jakarta Ant Section 3.4.
    [Show full text]
  • Java Programming [R17a0507]
    JAVA PROGRAMMING [R17A0507] LECTURE NOTES B.TECH II YEAR – II SEM (R17) (2018-19) DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING MALLA REDDY COLLEGE OF ENGINEERING & TECHNOLOGY (Autonomous Institution – UGC, Govt. of India) (Affiliated to JNTUH, Hyderabad, Approved by AICTE - Accredited by NBA & NAAC – ‘A’ Grade - ISO 9001:2015 Certified) Maisammaguda, Dhulapally (Post Via. Hakimpet), Secunderabad – 500100, Telangana State, INDIA. MALLA REDDY COLLEGE OF ENGINEERING & TECHNOLOGY DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING (R17A0507)JAVA PROGRAMMING Objectives: This subject aims to introduce students to the Java programming language. Upon successful completion of this subject, students should be able to create Java programs that leverage the object-oriented features of the Java language, such as encapsulation, inheritance and polymorphism; use data types, arrays and other data collections; implement error-handling techniques using exception handling, create and event-driven GUI using Swing components. UNIT-I OOP Concepts:- Data abstraction, encapsulation, inheritance, Benefits of Inheritance, Polymorphism, classes and objects, Procedural and object oriented programming paradigms. Java Programming- History of Java, comments, Data types, Variables, Constants, Scope and Lifetime of variables, Operators, Operator Hierarchy, Expressions, Type conversion and casting, Enumerated types, Control flow- block scope, conditional statements, loops, break and continue statements, simple java stand alone programs, arrays, console input and output, formatting output, constructors, methods, parameter passing, static fields and methods, access control, this reference, overloading methods and constructors, recursion, garbage collection, building strings, exploring string class. UNIT – II Inheritance – Inheritance hierarchies super and sub classes, Member access rules, super keyword, preventing inheritance: final classes and methods, the Object class and its methods. Polymorphism – dynamic binding, method overriding, abstract classes and methods.
    [Show full text]
  • 2D Animation of Recursive Backtracking Maze Solution Using Javafx Versus AWT and Swing
    2020 International Conference on Computational Science and Computational Intelligence (CSCI) CSCI-ISSE Full/Regular Research Paper 2D Animation of Recursive Backtracking Maze Solution Using JavaFX Versus AWT and Swing Anil L. Pereira School of Science and Technology Georgia Gwinnett College Lawrenceville, GA, USA [email protected] Abstract—This paper describes software developed by the AWT and Swing have been used widely in legacy software author, that constructs a two-dimensional graphical maze and uses [8]. Even though, software developers claim that there is a steep animation to visualize the recursive backtracking maze solution. learning curve for JavaFX [9], applications using AWT and The software is implemented using three Java graphics Swing are being rewritten with JavaFX. This is because of technologies, Java Abstract Window Toolkit, Java Swing and JavaFX’s look and feel and other features mentioned above. JavaFX. The performance of these technologies is evaluated with Also, the performance is claimed to be better, due to its graphics respect to their graphics rendering frame rate and heap memory rendering pipeline for modern graphics processing units (GPUs) utilization. The scalability of their rendering performance is [10]. This pipeline is comprised of: compared with respect to maze size and resolution of the displayed • A hardware accelerated graphics pipeline called Prism maze. A substantial performance gap between the technologies is reported, and the underlying issues that cause it are discussed, • A windowing toolkit for Prism called Glass such as memory management by the Java virtual machine, and • A Java2D software pipeline for unsupported graphics hardware accelerated graphics rendering. hardware • High-level support for making rich graphics simple Keywords—graphics; animation; JavaFX; Swing; AWT with Effects and 2D and 3D transforms I.
    [Show full text]
  • Manning Publications, Inc
    Preface An “early technology adopter” (also known as a techno-geek) like myself is usually ready to evaluate an exciting new API the day it is released (if not sooner). In late 1994, while attending a software developers’ conference in California, I encountered a past acquaintance who, at the time, was employed by Sun Microsystems. As I am apt to do, I began complaining to him about the generally inadequate state of the business, and, in particular, the coding effort and portability weaknesses in languages such as C and C++. After listen- ing to my droning for a while, my friend told me about a particularly interest- ing programming language coming from Sun Microsystems in just a couple of months. A new language from Sun? Aren’t they a UNIX workstation com- pany? What does a hardware company know about building computer lan- guages? I was skeptical about trying to use any language produced by Sun Microsystems. The language my friend was referring to was Java 1.0, which, as he pre- dicted, was shipped at the beginning of 1995. In late January of 1995, I con- nected to Sun’s World Wide Web site, pulled down the first version of the Java Development Kit (JDK), and immediately began tinkering. Although I didn’t yet understand the overall vision of Java, I was impressed with the platform independence, and with the speed at which I could build relatively complex prototypes. In these early stages, I viewed Java as a replacement for Microsoft’s Visual Basic as a prototyping tool; however, I was soon to appreci- ate the capabilities of this new language.
    [Show full text]
  • Solaris Java Plug-In User's Guide
    Solaris Java Plug-in User’s Guide Sun Microsystems, Inc. 901 San Antonio Road Palo Alto, CA 94303-4900 U.S.A. Part No: 806-1636–10 February 2000 Copyright 2000 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California 94303-4900 U.S.A. All rights reserved. This product or document is protected by copyright and distributed under licenses restricting its use, copying, distribution, and decompilation. No part of this product or document may be reproduced in any form by any means without prior written authorization of Sun and its licensors, if any. Third-party software, including font technology, is copyrighted and licensed from Sun suppliers. Parts of the product may be derived from Berkeley BSD systems, licensed from the University of California. UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open Company, Ltd. Sun, Sun Microsystems, the Sun logo, docs.sun.com, AnswerBook, AnswerBook2, Java, JDK, JavaBeans, and Solaris are trademarks, registered trademarks, or service marks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the U.S. and other countries. Products bearing SPARC trademarks are based upon an architecture developed by Sun Microsystems, Inc. Netscape Navigator is a trademark or registered trademark of Netscape Communications Corporation. The OPEN LOOK and SunTM Graphical User Interface was developed by Sun Microsystems, Inc. for its users and licensees. Sun acknowledges the pioneering efforts of Xerox in researching and developing the concept of visual or graphical user interfaces for the computer industry.
    [Show full text]
  • Java Look and Feel Design Guidelines
    User interface guidelines for designers of applications TM based on the JAVA JavaTM Foundation Classes LOOK AND FEEL DESIGN GUIDELINES JAVA™ LOOK AND FEEL DESIGN GUIDELINES Please send your email feedback to us at [email protected] JAVA™ LOOK AND FEEL DESIGN GUIDELINES Sun Microsystems, Inc. Addison-Wesley An imprint of Addison Wesley Longman, Inc. Reading, Massachusetts • Harlow, England • Menlo Park, California Berkeley, California • Don Mills, Ontario • Sydney • Bonn Amsterdam • Tokyo • Mexico City Copyright 1999 Sun Microsystems, Inc., 901 San Antonio Road, Copyright 1999 Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, California 94303 U.S.A. All rights reserved. Palo Alto, Californie 94303 Etats-Unis. Tous droits réservés. This product or documentation is protected by copyright and Ce produit ou document est protégé par un copyright et distribué distributed under licenses restricting its use, copying, avec des licences qui en restreignent l’utilisation, la copie, la distribution, and decompilation. No part of this product or distribution, et la décompilation. Aucune partie de ce produit ou documentation may be reproduced in any form by any means document ne peut être reproduite sous aucune forme, par without prior written authorization of Sun and its licensors, if any. quelque moyen que ce soit, sans l’autorisation préalable et écrite Third-party software, including font technology, is copyrighted de Sun et de ses bailleurs de licence, s’il y en a. Le logiciel détenu and licensed from Sun suppliers. par des tiers, et qui comprend la technologie relative aux polices de caractères, est protégé par un copyright et licencié par des Sun, Sun Microsystems, the Sun logo, Java, JavaHelp, Java 2D, fournisseurs de Sun.
    [Show full text]
  • Introduction to the Java Foundation Classes
    Introduction to the Java Foundation Classes Topics in This Chapter • The History of the Java Foundation Classes • Overview of JFC Features • The Swing Packages • Look-and-Feel and the Model-View-Controller Architecture 1 ChapterChapter he Java Foundation Classes bring new capabilities to the Java programmer, foremost among which are the components in the so-called Swing set. This Tchapter begins by looking briefly at the history of the Java programming lan- guage and of the Abstract Window Toolkit in particular. The Abstract Window Toolkit, or AWT for short, provides the classes used to build an application’s user interface. In both Java Development Kit (JDK) 1.0 and JDK 1.1, Java applications running under Windows looked just like Windows programs, while those running on Solaris looked the same as native applications written with the Motif toolkit. The reason for this was simply that much of the AWT is provided by code from the native platform’s window- ing system—the user interface components are rendered by Windows or by Motif, not by Java code. While this has its advantages, it also has drawbacks. For one thing, it is difficult to implement a single interface and map it to two (or more) host platforms that work differently. And even when you’ve done that, the controls themselves behave somewhat differently between the platforms. Because this behavior is part of the native windowing system, there’s nothing you can do about it. Implementing all of the user interface classes in Java gets rid of these problems at a stroke. That’s exactly what the Swing components, which are the most significant part of the Java Foundation Classes (JFC), do—they replace the native implementa- tion with a user interface library that works the same on all Java platforms.
    [Show full text]
  • Java Programming Language
    Sun Educational Services Java Programming Language SL-275 Sun Educational Services Java Programming Language September 1999 Copyright 1999 Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, California 94303, U.S.A. All rights reserved. This product or document is protected by copyright and distributed under licenses restricting its use, copying, distribution, and decompilation. No part of this product or document may be reproduced in any form by any means without prior written authorization of Sun and its licensors, if any. Third-party software, including font technology, is copyrighted and licensed from Sun suppliers. Parts of the product may be derived from Berkeley BSD systems, licensed from the University of California. UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open Company, Ltd. Sun, Sun Microsystems, the Sun Logo, Solstice, Java, JavaBeans, JDK, and Solaris are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the U.S. and other countries. Products bearing SPARC trade- marks are based upon an architecture developed by Sun Microsystems, Inc. The OPEN LOOK and Sun Graphical User Interface was developed by Sun Microsystems, Inc. for its users and licensees. Sun acknowledges the pioneering efforts of Xerox in researching and developing the concept of visual or graphical user interfaces for the computer industry. Sun holds a non-exclusive license from Xerox to the Xerox Graphical User Interface, which license also covers Sun’s licensees who implement OPEN LOOK GUIs and otherwise comply with Sun’s written license agreements.
    [Show full text]
  • An Introduction to Java Swing TAKE IT to the NTH
    TAKE IT TO THE NTH An Introduction to Java Swing TAKE IT TO THE NTH Asif Habibullah Member of Technical Staff, Software Market Development Engineering In Introduction to Java Swing An Introduction to Java Swing • What is Java Swing? • Swing GUI Fundamentals • Swing Components • Event Handling • Model-View-Controller (MVC) Design Pattern • Rich clients for Web Services • Deploy via Java Web Start What is Java Swing? • Graphical User Interface (GUI) component toolkit. • Complete set of user-interface elements written entirely in Java. • Integrated into the Java 2 platform (1.2 or higher). • No need to download and install on Java 2 platform. • If running Java 1.1, you can download and install separately. • Part of Java Foundation Classes (JFC) Java Foundation Classes (JFC) The Java Foundation Classes (JFC) extend the original Abstract Window Toolkit (AWT) by adding a comprehensive set of graphical user interface class libraries • What makes up the JFC (features)? • Swing • Accessibility API • Java 2D API • Drag and Drop API • AWT • Internationalization What about AWT? Swing AWT • Lightweight components • Heavyweight components • Complex components • Primitive components • Pluggable Look and Feel • Single Look and Feel • Pure Java – Platform • Not Pure Java – Platform independent dependent Lightweight vs. Heavyweight Lightweight Heavyweight • Not dependent on native peers • Dependent on native peers • Rely on primitive Java drawing • Rely on native windowing techniques in rendering. system in rendering. • Components behavior is the • Component behavior may same across platforms. differ across platforms. • Look and Feel is independent • Look and feel is dependent of platform on platform Swing GUI Fundamentals • Swing components • Containers • Non-containers • Layout Mangers • Event Handling Swing Containers Used to hold other Swing containers and components.
    [Show full text]
  • SWT and Jface
    05_094591 ch01.qxd 10/21/04 2:35 PM Page 3 Overview of Java UI Toolkits and SWT/JFace This chapter outlines the three main Java user interface (UI) toolkits: AWT, Swing, and JFace. First I provide a brief introduction to all three, and then I compare them, highlighting some of the advantages SWT/JFace offers. SWT/JFace allows you to access native features easily, and pro- grams based on SWT/JFace are considerably faster than those based on Swing in terms of execu- tion speed. SWT/JFace is designed to be very flexible, so you can program using either the traditional approach or the model-view-controller approach. After reading this chapter, you should have a general overview of SWT/JFace. The chapters that follow introduce various aspects of SWT/JFace in detail. Evolution of Java GUI Frameworks This section covers the following Java graphical user interface (GUI) frameworks: ❑ Abstract Window Toolkit (AWT): The first and the simplest windowing framework. ❑ Swing: Built on AWT, Swing offers peerless components. ❑ Standard WidgetCOPYRIGHTED Toolkit (SWT) and JFace: SWT MATERIAL is a native widget UI toolkit that provides a set of OS-independent APIs for widgets and graphics. JFace is a UI toolkit implementation using SWT to handle many common UI programming tasks. This section outlines the evolution of the Java GUI framework and highlights the key features we’ll compare and contrast in the next section. 05_094591 ch01.qxd 10/21/04 2:35 PM Page 4 Chapter 1 Abstract Window Toolkit The first version of Java, released by Sun Microsystems in 1995, enabled you to create programs on one platform and deliver the products to other Java-supported systems without worrying about the local environment — ”Write Once, Run Anywhere.” Most early Java programs were fancy animation applets running in Web browsers.
    [Show full text]