Programming with Visualage for Java Version 2

Total Page:16

File Type:pdf, Size:1020Kb

Programming with Visualage for Java Version 2 Programming with VisualAge for Java Version 2 John Akerley, Nina Li, Antonello Parlavecchia International Technical Support Organization http://www.redbooks.ibm.com SG24-5264-00 SG24-5264-00 International Technical Support Organization Programming with VisualAge for Java Version 2 November 1998 Take Note! Before using this information and the product it supports, be sure to read the general information in “Special Notices” on page 383. First Edition (November 1998) This edition applies to Version 2 of VisualAge for Java, Professional Edition, for use with the OS/2, Windows 95, or Windows NT operating systems. Sample Code on the Internet The sample code for this redbook is available as sg245264.zip on: ftp://www.redbooks.ibm.com/redbooks/SG245264 Download sg245264.zip and read the README.TXT file included in the file. Comments may be addressed to: IBM Corporation, International Technical Support Organization Dept. QXXE Building 80-E2 650 Harry Road San Jose, California 95120-6099 When you send information to IBM, you grant IBM a non-exclusive right to use or distribute the information in any way it believes appropriate without incurring any obligation to you. © Copyright International Business Machines Corporation 1998. All rights reserved Note to U.S Government Users – Documentation related to restricted rights – Use, duplication or disclosure is subject to restrictions set forth in GSA ADP Schedule Contract with IBM Corp. Contents Figures. .ix Tables. xv Tips . xvii Preface. .xix How to Use This Book . xix Conventions Used in This Book . xx Examples in This Book . xx World Wide Web Addresses in This Book . xx ITSO on the Internet. xxi VisualAge for Java Service and Support . xxi About the Authors. xxii Acknowledgments . xxii Comments Welcome . xxiii Chapter 1. Introduction to the Environment . 1 VisualAge for Java Product Family . 1 VisualAge for Java Professional . 2 VisualAge for Java Entry. 4 VisualAge for Java Enterprise. 4 Updates to VisualAge for Java . 5 Building Your First Applet. 5 Let’s Get Started! . 6 Creating an Animated Applet . 12 Changing the Properties of the Applet . 13 Building Your First Application . 14 The VisualAge for Java Scrapbook . 18 Using the Scrapbook. 19 Correcting Errors in the Scrapbook. 23 Customizing VisualAge for Java. 25 Workbench Options. 25 Chapter 2. Organizing Your Code . 29 Projects in VisualAge for Java . 29 The Workbench . 30 The Workbench Projects Page . 32 The Workbench Packages View . 34 Using Types from Other Packages . 36 © Copyright IBM Corp. 1998 iii The Workbench Classes Page . 38 The Workbench Interfaces Page. 39 The Workbench All Problems Page . 40 Importing and Exporting Java Code with VisualAge for Java. 42 Importing into VisualAge for Java . 43 Exporting from VisualAge for Java . 45 Chapter 3. Beginning the ATM Project . 49 ATM Application . 49 ATM Object Model . 52 JavaBeans . 53 Event Features . 54 Property Features . 55 Method Features . 56 Introspection and the BeanInfo Class . 57 Using VisualAge for Java to Create JavaBeans. 58 The Class Browser . 58 Using the BeanInfo Page . 63 What about the BeanInfo Class? . 66 Building the ATM Model . 68 Building the Transaction Class . 69 Building the BankAccount Bean . 71 Building the CheckingAccount Bean . 81 Building the SavingsAccount Bean . 86 Building the Card Bean . 87 Building the Customer Bean . 91 Building the Bank Bean. 94 Chapter 4. Building User Interfaces . 99 An Abstract Windowing Toolkit Refresher . 100 What Is the JFC? . 100 The JFC and the AWT . 101 JFC Components . 102 The JFC and the MVC Architecture . 104 Look and Feel. 105 Layout Managers . 106 FlowLayout . 107 BorderLayout. 107 BoxLayout . 108 CardLayout . 109 GridLayout. 110 GridBagLayout . 111 OverlayLayout . 111 iv Programming with VisualAge for Java Version 2 Using Layout Managers in VisualAge for Java . 112 Visual Composition Editor . 112 The Beans Palette. 114 Free-Form Surface . ..
Recommended publications
  • IMS Connector for Java User's Guide and Reference
    IBM VisualAge® for Java™,Version3.5 IMSConnectorforJava User’s Guide and Reference Note! Before using this information and the product it supports, be sure to read the general information under Notices. Edition notice This edition applies to Version 3.5 of IBM VisualAge for Java and to all subsequent releases and modifications until otherwise indicated in new editions. © Copyright International Business Machines Corporation 1998, 2000. All rights reserved. US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents Chapter 1. Understanding IMS Connector for Java ...........1 Prerequisites for using IMS Connector for Java .............3 IMS Connector for Java concepts and terms ..............4 Chapter 2. Preparing to use IMS Connector for Java ..........17 Preparing your VisualAge for Java Environment .............17 Preparing your WebSphere Studio Environment .............21 Preparing your WebSphere Application Server Environment ........22 Chapter 3. Building Java applications and servlets ..........31 Building Java Applications and Servlets for Conversational Transactions ....32 Chapter 4. Building a Java Application to Run an IMS Transaction ....35 Chapter 5. Building a Java Application to Run a Navigator .......53 Chapter 6. Building a Java Application for an IMS Transaction with Multi-Segment Output Messages.................69 Chapter 7. Building a Java Application for an IMS Transaction with Multi-Segment Input Messages .................75 Chapter 8. Building an Application to Run an IMS Transaction with Synchronization Level Confirm .................81 Chapter 9. Building the Graphical User Interface ...........87 Chapter 10. Building a Java Servlet to Run an IMS Transaction .....95 Chapter 11. Building a Web Application that Uses One Servlet to Run an IMS Conversation ......................107 Chapter 12.
    [Show full text]
  • Sound Invariant Checking Using Type Modifiers and Object Capabilities
    Sound Invariant Checking Using Type Modifiers and Object Capabilities. Isaac Oscar Gariano Victoria University of Wellington [email protected] Marco Servetto Victoria University of Wellington [email protected] Alex Potanin Victoria University of Wellington [email protected] Abstract In this paper we use pre existing language support for type modifiers and object capabilities to enable a system for sound runtime verification of invariants. Our system guarantees that class invariants hold for all objects involved in execution. Invariants are specified simply as methods whose execution is statically guaranteed to be deterministic and not access any externally mutable state. We automatically call such invariant methods only when objects are created or the state they refer to may have been mutated. Our design restricts the range of expressible invariants but improves upon the usability and performance of our system compared to prior work. In addition, we soundly support mutation, dynamic dispatch, exceptions, and non determinism, while requiring only a modest amount of annotation. We present a case study showing that our system requires a lower annotation burden compared to Spec#, and performs orders of magnitude less runtime invariant checks compared to the widely used ‘visible state semantics’ protocols of D, Eiffel. We also formalise our approach and prove that such pre existing type modifier and object capability support is sufficient to ensure its soundness. 2012 ACM Subject Classification Theory of computation → Invariants, Theory of computation → Program verification, Software and its engineering → Object oriented languages Keywords and phrases type modifiers, object capabilities, runtime verification, class invariants Digital Object Identifier 10.4230/LIPIcs.CVIT.2016.23 1 Introduction Object oriented programming languages provide great flexibility through subtyping and arXiv:1902.10231v1 [cs.PL] 26 Feb 2019 dynamic dispatch: they allow code to be adapted and specialised to behave differently in different contexts.
    [Show full text]
  • Method Proxy-Based AOP in Scala
    Vol. 0, No. 0, Z Method Proxy-Based AOP in Scala Daniel Spiewak and Tian Zhao University of Wisconsin – Milwaukee, fdspiewak,[email protected] This paper describes a fully-functional Aspect-Oriented Programming framework in Scala – a statically typed programming language with object-oriented and func- tional features. This framework is implemented as internal domain-specific lan- guages with syntax that is both intuitive and expressive. The implementation also enforces some static type safety in aspect definitions. 1 INTRODUCTION Aspect-Oriented Programming (AOP) implementations such as AspectJ provide language extensions of pointcuts and advices to insert code of crosscutting concerns into the base program through bytecode transformation. In this paper, we describe a framework to implement an AOP extension to the Scala language [13] using higher-order functions as AOP proxies 1. This framework allows programmers to specify pointcuts and aspects using a Domain Specific Language (DSL) [5] embedded within Scala. Our technique uses Scala’s higher-order functions to intercept method calls with minimal syntactic overhead imposed on the base program. This framework allows developers to define pointcuts by specifying class types and method signatures. The framework also allows access to context variables, while aspects can insert advice code before or after the advised body. The rest of the paper is organized as follows: In Section2, we present the main idea using an example. Section3 explains the syntax of pointcuts and advices. Section4 ex- plains the implementation details. We discuss the benefits and tradeoffs of our framework in Section5. and related works are in Section6. 2 EXAMPLE AOP enables developers to write code that is modularized to a point beyond the capabil- ities of vanilla object-oriented design.
    [Show full text]
  • AP Computer Science Basic OOP — Implementing Classes
    AP Computer Science Basic OOP — Implementing Classes ORIENTATION Object-oriented programming (OOP) refers to the organization of data into classes, categories that represent a given type of “object.” An object can be a model of a real-life thing like a car, a six-sided die, or a person, or it can be a representation of something more abstract like a point in space, a menu item, or a digital clipboard. An object that belongs to a given class is called an instance of that class, and any instance of a class keeps track of its state using instance variables, or attributes. The object is created when its constructor is called, and can be interacted with by calling its methods, which may access data (accessor methods, or “getters”) or alter the object’s data (mutator methods, or “setters”). There are two important theoretical concepts in OOP: abstraction and encapsulation. Objects and the classes they belong to act as abstractions of the things they represent: a Java class called Person isn’t actually a person, of course, but a simplified representation of a person in terms of a limited number of qualities (name and age, perhaps). Other details such as hair color, nationality, and gender identity aren’t included in our abstraction of a person. Encapsulation refers to the way that a class and its methods hide away the details of a process. Someone using a QuadraticFormula class can call the hasSolutions() method to find out whether their equation has solutions without knowing what a discriminant is. The programmer and the class she has written have hidden that information away in a metaphorical “black box.” Basic OOP consists primarily of implementing classes: writing the JavaDocs, class header, constructors, attributes, and methods for an object as specified.
    [Show full text]
  • Some Global Optimizations for a Prolog Compiler
    View metadata, citation and similar papers at core.ac.uk brought to you by CORE provided by Elsevier - Publisher Connector J. LOGIC PROGRAMMING 1985:1:43-66 43 SOME GLOBAL OPTIMIZATIONS FOR A PROLOG COMPILER C. S. MELLISH 1. INTRODUCTION This paper puts forward the suggestion that many PROLOG programs are not radically different in kind from programs written in conventional languages. For these programs, it should be possible for a PROLOG compiler to produce code of similar efficiency to that of other compilers. Moreover, there is no reason why reasonable efficiency should not be obtained without special-purpose hardware. Therefore, at the same time as pursuing the goal of special hardware for running PROLOG programs, we should be looking at how to maximize the use of conven- tional machines and to capitalize on developments in conventional hardware. It seems unlikely that conventional machines can be efficiently used by PROLOG programs without the use of sophisticated compilers. A number of possible optimiza- tions that can be made on the basis of a static, global analysis of programs are presented, together with techniques for obtaining such analyses. These have been embodied in working programs. Timing figures for experimental extensions to the POPLOG PROLOG compiler are presented to make it plausible that such optimiza- tions can indeed make a difference to program efficiency. 2. WHAT ARE REAL PROLOG PROGRAMS LIKE? It is unfortunate that very little time has been spent on studying what kinds of programs PROLOG programmers actually write. Such a study would seem to be an important prerequisite for trying to design a PROLOG optimising compiler.
    [Show full text]
  • Eclipse Project Briefing Materials
    [________________________] Eclipse project briefing materials. Copyright (c) 2002, 2003 IBM Corporation and others. All rights reserved. This content is made available to you by Eclipse.org under the terms and conditions of the Common Public License Version 1.0 ("CPL"), a copy of which is available at http://www.eclipse.org/legal/cpl-v10.html The most up-to-date briefing materials on the Eclipse project are found on the eclipse.org website at http://eclipse.org/eclipse/ 200303331 1 EclipseEclipse ProjectProject 200303331 3 Eclipse Project Aims ■ Provide open platform for application development tools – Run on a wide range of operating systems – GUI and non-GUI ■ Language-neutral – Permit unrestricted content types – HTML, Java, C, JSP, EJB, XML, GIF, … ■ Facilitate seamless tool integration – At UI and deeper – Add new tools to existing installed products ■ Attract community of tool developers – Including independent software vendors (ISVs) – Capitalize on popularity of Java for writing tools 200303331 4 Eclipse Overview Another Eclipse Platform Tool Java Workbench Help Development Tools JFace (JDT) SWT Team Your Tool Plug-in Workspace Development Debug Environment (PDE) Their Platform Runtime Tool Eclipse Project 200303331 5 Eclipse Origins ■ Eclipse created by OTI and IBM teams responsible for IDE products – IBM VisualAge/Smalltalk (Smalltalk IDE) – IBM VisualAge/Java (Java IDE) – IBM VisualAge/Micro Edition (Java IDE) ■ Initially staffed with 40 full-time developers ■ Geographically dispersed development teams – OTI Ottawa, OTI Minneapolis,
    [Show full text]
  • Eclipse (Software) 1 Eclipse (Software)
    Eclipse (software) 1 Eclipse (software) Eclipse Screenshot of Eclipse 3.6 Developer(s) Free and open source software community Stable release 3.6.2 Helios / 25 February 2011 Preview release 3.7M6 / 10 March 2011 Development status Active Written in Java Operating system Cross-platform: Linux, Mac OS X, Solaris, Windows Platform Java SE, Standard Widget Toolkit Available in Multilingual Type Software development License Eclipse Public License Website [1] Eclipse is a multi-language software development environment comprising an integrated development environment (IDE) and an extensible plug-in system. It is written mostly in Java and can be used to develop applications in Java and, by means of various plug-ins, other programming languages including Ada, C, C++, COBOL, Perl, PHP, Python, Ruby (including Ruby on Rails framework), Scala, Clojure, and Scheme. The IDE is often called Eclipse ADT for Ada, Eclipse CDT for C/C++, Eclipse JDT for Java, and Eclipse PDT for PHP. The initial codebase originated from VisualAge.[2] In its default form it is meant for Java developers, consisting of the Java Development Tools (JDT). Users can extend its abilities by installing plug-ins written for the Eclipse software framework, such as development toolkits for other programming languages, and can write and contribute their own plug-in modules. Released under the terms of the Eclipse Public License, Eclipse is free and open source software. It was one of the first IDEs to run under GNU Classpath and it runs without issues under IcedTea. Eclipse (software) 2 Architecture Eclipse employs plug-ins in order to provide all of its functionality on top of (and including) the runtime system, in contrast to some other applications where functionality is typically hard coded.
    [Show full text]
  • Visualage Generator: User's Guide
    VisualAge Generator User’s Guide Ve r s i o n 4 .5 SH23-0268-01 Note Before using this document, read the general information under “Notices” on page xi. Third Edition (April 2001) This edition applies to the following licensed programs: v IBM VisualAge Generator Developer for OS/2 and Windows NT Version 4.5 v IBM VisualAge Generator Server for OS/2, AIX, Windows NT, HP-UX, and Solaris Version 4.5 v IBM VisualAge Generator Server for AS/400 Version 4 Release 4 v IBM VisualAge Generator Server for MVS, VSE, and VM Version 1.2 Order publications by phone or fax. IBM Software Manufacturing Solutions takes publication orders between 8:30 a.m. and 7:00 p.m. eastern standard time (EST). The phone number is (800) 879-2755. The fax number is (800) 445-9269. Faxes should be sent Attn: Publications, 3rd floor. You can also order publications through your IBM representative or the IBM branch office serving your locality. Publications are not stocked at the address below. IBM welcomes your comments. You can send your comments in any one of the following methods: Electronically, using the online reader comment form at the address listed below. Be sure to include your entire network address if you wish a reply. v http://www.ibm.com/software/ad/visgen By mail to the following address: IBM Corporation, Attn: Information Development, Department G7IA Building 503, P.O. Box 12195, Research Triangle Park, NC 27709-2195. When you send information to IBM, you grant IBM a nonexclusive right to use or distribute the information in any way it believes appropriate without incurring any obligation to you.
    [Show full text]
  • Incremental Compilation in Compose*
    Incremental Compilation in Compose? A thesis submitted for the degree of Master of Science at the University of Twente Dennis Spenkelink Enschede, October 28, 2006 Research Group Graduation Committee Twente Research and Education prof. dr. ir. M. Aksit on Software Engineering dr. ir. L.M.J. Bergmans Faculty of Electrical Engineering, M.Sc. G. Gulesir Mathematics and Computer Science University of Twente Abstract Compose? is a project that provides aspect-oriented programming for object-oriented lan- guages by using the composition filters model. In particular, Compose?.NET is an implemen- tation of Compose? that provides aspect-oriented programming to Microsoft Visual Studio languages. The compilation process of Compose?.NET contains multiple compilation modules. Each of them has their own responsibilities and duties such as parsing, analysis tasks and weaving. However, all of them suffer from the same problem. They do not support any kind of incre- mentality. This means that they perform all of their operations in each compilation without taking advantage of the results and efforts of previous compilations. This unavoidably results in compilations containing many redundant repeats of operations, which slow down compila- tion. To minimize these redundant operations and hence, speed up the compilation, Compose? needs an incremental compilation process. Therefore, we have developed a new compilation module called INCRE. This compilation module provides incremental performance as a service to all other compilation modules of Compose?. This thesis describes in detail the design and implementation of this new compila- tion module and evaluates its performance by charts of tests. i Acknowledgements My graduation time was a long but exciting process and I would not have missed it for the world.
    [Show full text]
  • Separate Compilation As a Separate Concern
    Separate Compilation as a Separate Concern A Framework for Language-Independent Selective Recompilation Nathan Bruning Separate Compilation as a Separate Concern THESIS submitted in partial fulfillment of the requirements for the degree of MASTER OF SCIENCE in COMPUTER SCIENCE by Nathan Bruning born in Dordrecht, the Netherlands Software Engineering Research Group Department of Software Technology Faculty EEMCS, Delft University of Technology Delft, the Netherlands www.ewi.tudelft.nl c 2013 Nathan Bruning. All rights reserved. Separate Compilation as a Separate Concern Author: Nathan Bruning Student id: 1274465 Email: [email protected] Abstract Aspect-oriented programming allows developers to modularize cross-cutting con- cerns in software source code. Concerns are implemented as aspects, which can be re-used across projects. During compilation or at run-time, the cross-cutting aspects are “woven” into the base program code. After weaving, the aspect code is scattered across and tangled with base code and code from other aspects. Many aspects may affect the code generated by a single source module. It is difficult to predict which dependencies exist between base code modules and aspect modules. This language-specific information is, however, crucial for the development of a compiler that supports selective recompilation or incremental compilation. We propose a reusable, language-independent framework that aspect-oriented lan- guage developers can use to automatically detect and track dependencies, transpar- ently enabling selective recompilation. Our implementation is based on Stratego/XT, a framework for developing transformation systems. By using simple and concise rewrite rules, it is very suitable for developing domain-specific languages. Thesis Committee: Chair: Prof.
    [Show full text]
  • Learn Objective–C on The
    CYAN YELLOW SPOT MATTE MAGENTA BLACK PANTONE 123 C BOOKS FOR PROFESSIONALS BY PROFESSIONALS® Companion eBook Available Learn Objective-CLearn • Learn the native programming language for Mac OS X, Everything You Need to Know as well as the iPhone! to Become an Objective-C Guru • Get up and running quickly with Objective-C. We don’t waste time teaching you basic programming; instead, we focus on what makes Objective-C di!erent and cool. • Learn about sophisticated programming concepts, including object-oriented programming, the Open-Closed Principle, refactoring, key-value coding, and predicates. n this book, you’ll !nd a full exploration of the Objective-C programming Ilanguage, the primary language for creating Mac OS X and iPhone applica- tions. There are goodies here for everyone, whether you’re just starting out as a Mac developer or a grizzled programmer coming from another language. You’ll discover all of the object-oriented purity and Smalltalk heritage coolness of Objective-C—such as instantiation, protocols for multiple inheritance, dynamic typing, and message forwarding. Along the way, you’ll meet Xcode, the Mac development environment, and you’ll learn about Apple’s Cocoa toolkit. on the Nearly everyone wants to be able to develop for Mac OS X or the iPhone these days, and it’s no wonder. The Mac is a fun and powerful platform, and Objective-C is a wonderful language for writing code. You can have a great time programming the Mac in Objective-C. We do, and want you to join us! Mark Dalrymple is a longtime Mac and Unix programmer who has Mac code running all over the world.
    [Show full text]
  • Visualage Pacbase: CODASYL DATABASE DESCRIPTION
    VisualAge Pacbase CODASYL DATABASE DESCRIPTION Ve r s i o n 3.5 VisualAge Pacbase CODASYL DATABASE DESCRIPTION Ve r s i o n 3.5 Note Before using this document, read the general information under “Notices” on page v. You may consult or download the complete up-to-date collection of the VisualAge Pacbase documentation from the VisualAge Pacbase Support Center at: http://www.ibm.com/support/docview.wss?rs=37&uid=swg27005477 Consult the Catalog section in the Documentation home page to make sure you have the most recent edition of this document. First Edition (September 2007) This edition applies to the following licensed programs: v VisualAge Pacbase Version 3.5 Comments on publications (including document reference number) should be sent electronically through the Support Center Web site at: http://www.ibm.com/software/awdtools/vapacbase/support.html or to the following postal address: IBM Paris Laboratory 1, place Jean–Baptiste Clément 93881 Noisy-le-Grand, France. When you send information to IBM, you grant IBM a nonexclusive right to use or distribute the information in any way it believes appropriate without incurring any obligation to you. © Copyright International Business Machines Corporation 1983,2007. All rights reserved. US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents Notices . .v DM4 Schema (DDL)/type M4: Screens . .84 DM4 Schema (DDL) / M4 Type: Generated Trademarks . vii Description . .90 DM4 Schema (DMCL) / M2 Type: Screens . .92 Chapter 1. Introduction . .1 DM4 Schema (DMCL) / M2 Type: Generated VisualAge Pacbase Module . .1 Description . .98 Introduction to the Database Description DM4 Sub-schema / M3 Type: Screens .
    [Show full text]