Contents Introduction 1

Similar documents
Index SELF-STUDY. Symbols

Introduction... xv SECTION 1: DEVELOPING DESKTOP APPLICATIONS USING JAVA Chapter 1: Getting Started with Java... 1

Contents. iii Copyright 1998 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services August 1998, Revision B

CONTENTS. Chapter 1 Getting Started with Java SE 6 1. Chapter 2 Exploring Variables, Data Types, Operators and Arrays 13

Swing. By Iqtidar Ali

Table of Contents. Chapter 1 Getting Started with Java SE 7 1. Chapter 2 Exploring Class Members in Java 15. iii. Introduction of Java SE 7...

Graphical User Interface (GUI) components in Java Applets. With Abstract Window Toolkit (AWT) we can build an applet that has the basic GUI

Murach s Beginning Java with Eclipse

Java IDE Programming-I

1 OBJECT-ORIENTED PROGRAMMING 1

Supporting Materials

Introduction. Assessment Test. Part I The Programmer s Exam 1

Application Development in JAVA. Data Types, Variable, Comments & Operators. Part I: Core Java (J2SE) Getting Started

JAVA. A. Zakiuddin Ahmed. M.Sc.,M.Phil M.S.(Edn), PGDCSM, Professor in Computer Science, P. Rizwan Ahmed. MCA., M.Sc.,M.A., M.Phil.

Discipline : MCA. Semester : IV. Subject : Advanced Java Programming. Lesson Plan Duration : 15 weeks (from January 2018 to April 2018)

Oracle 10g: Java Programming

Introduction p. 1 JFC Architecture p. 5 Introduction to JFC p. 7 The JFC 1.2 Extension p. 8 Swing p. 9 Drag and Drop p. 16 Accessibility p.

Borland JBuilder 7 Product Certification. Study Guide

Chapter 2 FEATURES AND FACILITIES. SYS-ED/ Computer Education Techniques, Inc.

Handout 14 Graphical User Interface (GUI) with Swing, Event Handling

"Charting the Course... Java Programming Language. Course Summary

Core Java SYLLABUS COVERAGE SYLLABUS IN DETAILS

OracleAS 10g R3: Java Programming

SCHEME OF COURSE WORK

CSE 1325 Project Description

This page intentionally left blank

[Course Overview] After completing this module you are ready to: Develop Desktop applications, Networking & Multi-threaded programs in java.

Advanced Java Programming

CHAPTER 1: A GENERAL INTRODUCTION TO PROGRAMMING 1

CONTENTS. INTRODUCTION xvii

IT6503 WEB PROGRAMMING. Unit-I

Certified Eclipse Bundle

E Oracle 10g Java Bootcamp I v1

Type of Classes Nested Classes Inner Classes Local and Anonymous Inner Classes

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

MyProgram m i ng Lab. get with the programming. Through the power of practice and immediate personalized

INSTITUTE OF AERONAUTICAL ENGINEERING

John Hunt and Alex McManus. Key Java. Advanced Tips and Techniques

Rizvi College of Arts, Science & Commerce Bandra (W), Mumbai Teaching Plan Academic Year

Part 3: Graphical User Interface (GUI) & Java Applets

Index. Note: Boldface numbers indicate illustrations.

1 CUSTOM TAG FUNDAMENTALS PREFACE... xiii. ACKNOWLEDGMENTS... xix. Using Custom Tags The JSP File 5. Defining Custom Tags The TLD 6

Visit for more.

JAVA & J2EE UNIT -1 INTRODUCTION

Swing UI. Powered by Pentalog. by Vlad Costel Ungureanu for Learn Stuff

CSE 143. Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT

Chapter 1 GETTING STARTED. SYS-ED/ Computer Education Techniques, Inc.

PROGRAMMING DESIGN USING JAVA (ITT 303) Unit 7

25. DECUS Symposium THE Application Development Environment for OpenVMS

SELF-STUDY. Glossary

Certified Eclipse Bundle

Chapter 12 GUI Basics

Widgets. Widgets Widget Toolkits. User Interface Widget

Contents Chapter 1 Introduction to Programming and the Java Language

Excel Programming with VBA (Macro Programming) 24 hours Getting Started

Essential Series. Springer-Verlag London Ltd.

How to be a Good Bean

Page 1 of 7. public class EmployeeAryAppletEx extends JApplet

Widgets. Overview. Widget. Widgets Widget toolkits Lightweight vs. heavyweight widgets Swing Widget Demo

JAVA COURSES. Empowering Innovation. DN InfoTech Pvt. Ltd. H-151, Sector 63, Noida, UP

Graphical User Interface (GUI)

CS111: PROGRAMMING LANGUAGE II

Object Oriented Programming with Java. Unit-1

Graphical User Interfaces. Swing. Jose Jesus García Rueda

Java Swing. based on slides by: Walter Milner. Java Swing Walter Milner 2005: Slide 1

UNIT -I PART-A Q.No Question Competence BTL

Swing from A to Z Some Simple Components. Preface

Programming graphics

Table of Contents. Introduction... xxi

Outline. Introduction to Java. What Is Java? History. Java 2 Platform. Java 2 Platform Standard Edition. Introduction Java 2 Platform

2110: GUIS: Graphical User Interfaces

JTcl and Swank. Bruce A. Johnson, Tom Poindexter, & Dan Bodoh. What s new with Tcl and Tk on the JVM. Wednesday, October 26, 11

Java Training For Six Weeks

Introduction to Graphical Interface Programming in Java. Introduction to AWT and Swing

Graphical User Interfaces. Comp 152

All the Swing components start with J. The hierarchy diagram is shown below. JComponent is the base class.

[CHAPTER] 1 INTRODUCTION 1

Graphics. Lecture 18 COP 3252 Summer June 6, 2017

Sri Vidya College of Engineering & Technology

JBuilder 8.0 JFC and Swing Programming

PSD1B Advance Java Programming Unit : I-V. PSD1B- Advance Java Programming

Contents I Introduction 1 Introduction to PL/SQL iii

A Web-Based Introduction

Bharati Vidyapeeth s Institute of Computer Applications and Management A-4, Paschim Vihar, New Delhi-63.

SD Module-1 Advanced JAVA

Is image everything?

A Tool for Automated GUI Program Grading

SD Module-1 Advanced JAVA. Assignment No. 4

Oracle Data Integrator: Administration and Development Volume I Student Guide

CSE 331. Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT

(800) Toll Free (804) Fax Introduction to Java and Enterprise Java using Eclipse IDE Duration: 5 days

ITT Technical Institute. SD1420 Introduction to Java Programming Onsite Course SYLLABUS

Object-Oriented Programming and Data Structures

Tool Kits, Swing. Overview. SMD158 Interactive Systems Spring Tool Kits in the Abstract. An overview of Swing/AWT

Acknowledgements...xvii. Foreword...xix

John Cowell. Essential Java Fast. How to write object oriented software for the Internet. with 64 figures. Jp Springer

Java Application Development

ABOUT CORE JAVA COURSE SCOPE:

Syllabus & Curriculum for Certificate Course in Java. CALL: , for Queries

ощ 'ршорвшэш! цвн-эориэу ощ 'sajbpossv # PIPG DUJ 'ssjmoossv ^ PIPG pipa w н OX ЛЮН VAV

Transcription:

SELF-STUDY iii Introduction 1 Course Purpose... 1 Course Goals...1 Exercises... 2 Scenario-Based Learning... 3 Multimedia Overview... 3 Assessment... 3 Hardware and Software Requirements... 4 Chapter 1 Java Basics 5 Objectives... 6 Pre-Test Questions... 6 Introduction... 6 What is Java?... 7 A Brief History of Java... 7 The Properties of the Java Language... 8 Platform-independent... 9 Robust... 9 Secure... 9 Object-oriented...9 Multi-threaded... 10 Object-oriented programming... 11 The Properties, Methods, Events (PME) Paradigm... 14 Applets, Applications, and Servlets... 17 Summary... 17 Post-Test Questions... 18 Chapter 2 Introduction to VisualAge 19 Objectives... 20 Pre-Test Questions... 20 Installation... 21 Introduction... 23 Projects... 24 VisualAge Windows and Palettes... 27 The beans list window... 28 The design window... 28 The property window... 28 The component palette... 29

iv Visual Programming Basics... 29 Components as objects... 30 Connecting components... 31 Running programs... 32 Exercise 2-1: Creating your first applet... 33 Summary... 34 Post-Test Questions... 35 Chapter 3 Introduction to Java Source Code 37 Objectives... 38 Pre-Test Questions... 38 Introduction... 39 The Four Levels of a Java Program... 39 Basic Java Syntax... 41 Comments... 43 The Format of Classes... 43 The Java class hierarchy... 44 Objects are instances of classes... 45 Editing the Visual Model... 48 Saving versions of your project... 48 Deleting components... 53 Deleting connections... 53 Switching between the Workbench and design windows... 54 Deploying Servlets, Applets, and Applications... 54 What is a Bean?... 55 Your First Class in Visual Age for Java... 56 Shortcuts and Time-Savers... 59 Configuring the Compiler... 59 Exercise 3-1: Practice editing... 63 Summary... 63 Post-Test Questions... 64 Chapter 4 Basic Components 65 Objectives... 66 Pre-Test Questions... 66 Introduction... 67 The Java AWT... 67 Purpose of the Java AWT... 67 The basic components of Java AWT... 68 The common properties of AWT components... 69 Instance variables and "faux" variables... 70

v Properties of the Basic AWT Components... 71 Data Entry components... 71 Button and Checkbox components... 73 List components... 74 Setting the contents of a Choice or List... 75 Exercise 4-1: Creating the quiz project... 76 The Swing Package... 78 Properties of the Basic Swing Components... 78 Swing vs. AWT... 80 Summary... 80 Post-Test Questions... 81 Chapter 5 Containers 83 Objectives... 84 Pre-Test Questions... 84 Introduction... 84 Basic Components and Forms... 85 Swing Containers... 86 Basic Containers... 87 Common Properties of Containers... 89 Form Properties... 92 Setting Container Properties... 92 Adding Components... 92 The Add Method... 93 Exercise 5-1: Using containers... 93 Summary... 95 Post-Test Questions... 95 Chapter 6 Layouts 97 Objectives... 98 Pre-Test Questions... 98 Introduction... 98 Ways to Use layouts... 99 Java Layouts... 100 Basic layout properties... 100 Flow layout... 101 Grid layout... 102 Border layout... 104 Card layout... 106 Box layout... 107 Gridbag layout... 107 Nested containers and nested layouts... 107

vi Arranging and Copying Components... 108 Arranging components... 109 Copying and pasting components... 110 Moving and copying containers... 111 Exercise 6-1: Working with layouts... 112 Applying Layout Managers to Gui s... 114 Adding components to containers with Managers... 114 Default Layout Manager... 115 Visually Laying Out Components... 115 Using Visual Beans... 115 Summary... 116 Post-Test Questions... 116 Chapter 7 Java Events 117 Objectives... 118 Pre-Test Questions... 118 Introduction... 118 Event Handling... 119 Connections Between Objects... 121 Creating Connections in Visual Age... 123 Visually Connect Objects... 123 Add Events Listeners to components... 126 Effects of events on other components... 129 Creating Connections in Source Code... 129 Register an event listener... 130 Create an event handler method... 131 Specify the method and parameters... 133 Code for Connections in VisualAge... 134 How Connections Are Executed... 135 Exercise 7-1: Making basic connections... 135 Summary... 137 Post-Test Questions... 137 Chapter 8 Connections 139 Objectives... 140 Pre-Test Questions... 140 Introduction... 140 Features of Connections... 141 Source features... 141 Target features... 141

vii Three Kinds of Connections... 142 Property-to-property connections... 143 Event-based connections... 144 Event-to-code connections... 144 Parameter connections... 145 Showing and Hiding Connections... 145 Features of AWT Components... 145 Common features of AWT components... 146 Button...146 Checkbox... 147 TextField... 147 TextArea... 148 List... 148 Choice...149 CheckboxGroup... 149 Window features... 150 Applet features... 150 Features of Swing Components... 151 Common features of swing components... 151 JButton...152 JCheckbox... 152 JTextField... 153 JTextArea... 153 JList... 154 JToolBar... 154 JToolBarButton... 154 JToolBarSeparator... 155 JTree... 155 JRadioButton... 155 JComboBox... 156 JSlider... 156 JTable... 157 JTableColumn... 157 JLabel... 157 JScrollBar...158 JPasswordField... 158 Window features... 159 JApplet features... 159 Window features... 160 Applet features... 160

viii Methods in Source Code... 161 Method definitions... 161 Method calls... 162 Get and set methods... 163 Exercise 8-1: Adding questions to the QuizApplet... 163 Summary... 166 Post-Test Questions... 167 Chapter 9 Applets in HTML Pages 169 Objectives... 170 Pre-Test Questions... 170 Introduction... 170 Applets on Web Pages... 171 Exporting Java files... 171 The APPLET HTML Tag... 172 HTML Parameters in an APPLET Tag... 173 Accepting HTML Parameters in an Applet... 173 Multimedia... 174 The OBJECT Tag... 175 Java Technologies... 176 JDK 1.0... 177 JDK 1.1... 177 JDK 1.2... 178 The Future of Java... 178 Exercise 9-1: Creating an applet... 178 Exercise 9-2: Using an interface... 179 Summary... 179 Post-Test Questions... 180 Chapter 10 Java Security and Applications 181 Objectives... 182 Pre-Test Questions... 182 Introduction... 183 Applet Security... 183 Client-side security... 184 Server-side security... 185 Relaxing Java Security... 186 Relaxing client-side security: signed applets... 186 Relaxing server-side security: servlets... 186 Applications... 187 Creating Applications... 187 Adding a frame to the application... 188 Adding a ScrollPane and Panel to a Frame... 189

ix Using an Application Template... 190 Exercise 10-1: Creating a quiz application... 192 Authentication... 194 Code Signing... 194 Summary... 195 Post-Test Questions... 195 Chapter 11 Java Menus 197 Objectives... 198 Pre-Test Questions... 198 Introduction... 199 Menus...199 MenuBar... 200 Menu...200 MenuItem... 201 CheckboxMenuItem... 201 MenuSeparator... 202 PopupMenu... 202 Adding Menus to a Program... 202 Connecting MenuItems... 203 Connecting an exit MenuItem to the exit() method... 203 Reacting to menu actions... 204 icons and menus... 204 Keyboard Accelerators... 205 Enabling/disabling menu items... 205 Adding New Windows to an Application... 206 Connecting a component to open a window... 206 Ordering a window to close... 207 Adding Menus to an Applet... 207 Exit MenuItems in applet frames... 208 Exercise 11-1: Adding menus to the QuizApplication... 209 Summary... 212 Post-Test Questions... 212 Chapter 12 Java Input and Output 213 Objectives... 214 Pre-Test Questions... 214 Introduction... 215 Input, Output and Streams... 216 Loading and Saving in Java Applications... 217 Adding File Dialogs to Your Program... 218 Adding loadfile and savefile Methods... 219 Customizing loadfile and savefile... 222 loadfile and savefile templates... 223

x Connecting Open and Save Methods... 223 Text Files...224 Exercise 12-1: (Optional) Adding Open and Save options to the QuizApplication... 224 Summary... 227 Post-Test Questions... 227 Chapter 13 Java Variables 229 Objectives... 230 Pre-Test Questions... 230 Introduction... 231 Why Java Source Code?... 231 Review...232 Format of Java source code... 232 Format of Java classes... 232 Format of Java methods... 233 Method calls... 233 Variables and Classifications... 234 Type... 234 Scope... 235 Privacy modifiers... 235 Creating Variables... 236 Variable declaration... 236 Variable initialization... 237 A Return to Classes... 238 Arithmetic Operations... 239 Variable assignment... 240 Char, Boolean and String assignments... 240 Arithmetic expressions... 241 String arithmetic... 241 Matching types... 242 Technical Issues for Variables... 242 Advanced Java naming conventions... 243 Passed-by-value vs. passed-by-reference... 243 Exercise 13-1: Using variables and arithmetic... 247 Summary... 248 Post-Test Questions... 248

xi Chapter 14 Conditionals and Arrays 249 Objectives... 250 Pre-Test Questions... 250 Introduction... 251 Decision-making... 251 Boolean Conditions... 252 Format for if else Statements... 254 The Switch Statement... 257 Boolean Arithmetic... 258 Comparing Strings and Objects... 260 Arrays... 261 Declaring arrays... 262 Instantiating arrays... 262 Accessing elements... 263 Initializing elements... 264 Exercise 14-1: Using conditional statements and arrays... 265 Summary... 268 Post-Test Questions... 269 Chapter 15 Loops 271 Objectives... 272 Pre-Test Questions... 272 Introduction... 273 Repeated Tasks... 273 For Loops... 274 Variations on for loops... 276 While Loops... 277 Do-While Loops... 278 The Break Keyword... 280 Continue... 281 Labelled Break and Continue Statements... 282 Arrays and Loops... 283 The length property of arrays... 283 Exercise 15-1: Using loops (optional)... 284 Summary... 286 Post-Test Question... 286

xii Chapter 16 Java Beans 287 Objectives... 288 Pre-Test Questions... 288 Introduction... 289 Component Approach to Design... 289 Approaches to software components... 290 JavaBeans... 292 Characteristics... 292 Classes as Beans... 294 Using JavaBeans in VisualAge... 294 Importing JavaBeans into the Workbench... 295 Adding new categories to the component palette... 296 Adding new Beans to the component palette... 296 Using new Beans from the component palette... 297 Creating Reusable Beans... 297 Using The Beaninfo Page... 298 Creating and Modifying JavaBean Features... 298 Property Attributes... 299 Method Features... 300 Creating and using Event Sets and Listeners... 301 Property Editors and Bean Customizers... 301 Places to Find Beans... 302 Exercise 16-1: Working with JavaBeans... 302 Summary... 303 Post-Test Questions... 303 Chapter 17 Java Resources 305 Objectives... 306 Pre-Test Questions... 306 Introduction... 306 VisualAge's Debugging Tools... 307 Generated code... 308 Syntactical vs. logical errors... 309 VisualAge Help... 310 Online help for VisualAge... 311 VisualAge tutorial... 311 Java on the Internet... 311 Java Textbooks... 313 Other IDEs... 314 VisualAge... 314 Visual Café... 314 JBuilder...314

xiii Summary... 315 Post-Test Questions... 315 Chapter 18 Java Database Connectivity (JDBC) 317 Objectives... 318 Pre-Test Questions... 318 Introduction... 319 Databases... 319 Installing JDBC... 320 SQL Keywords... 320 Accessing databases using beans... 322 ODBC Database Manager... 325 Using JDBC... 329 JDBC using a SMARTGUIDE... 332 Using SQLJ... 350 Setting up SQLJ... 350 SQLJ file creation... 351 connecting gui s to database applications... 352 Summary... 353 Post-Test Questions... 354 Chapter 19 Remote Method Invocation 355 Objectives... 356 Pre-Test Questions... 356 Introduction... 357 RMI overview... 357 Applets and Rmi... 357 Stub and Skeleton Classes... 358 The Interface... 358 Creating and Distributing Remote Objects... 359 Invoking Methods on Remote Objects... 360 Exercise 19-1: Creating and implementing an RMI interface using VisualAge for Java 361 Connecting remote objects... 364 Summary... 365 Post-Test Questions... 365 Appendix A Answers to Pre-Test and Post-Test Questions 367 Appendix B Supplemental File List 379 Glossary 381 Index 393

xiv