lab 0 objectives input a basic java program learn the basics of visualage

21
Lab 0 Objectives Input a basic Java Program Learn the basics of VisualAge

Post on 21-Dec-2015

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lab 0 Objectives Input a basic Java Program Learn the basics of VisualAge

Lab 0

ObjectivesInput a basic Java Program

Learn the basics of VisualAge

Page 2: Lab 0 Objectives Input a basic Java Program Learn the basics of VisualAge

Requirements:

Build a Welcome Applet equivalent to the one described below using the tools of VisualAge.

Import code for the applet in fig3.10 – you can find this in the shared directory.

Learn how to clean up. VisualAge is a shared repository and you MUST not leave your code behind for the next student.

Page 3: Lab 0 Objectives Input a basic Java Program Learn the basics of VisualAge

Open VisualAge

Under Selected

Choose Add and then

Project . . .

Part 1

Page 4: Lab 0 Objectives Input a basic Java Program Learn the basics of VisualAge

In the SmartGuide

Choose

Create a new project

Name it, say, Project1

Click Finish

Page 5: Lab 0 Objectives Input a basic Java Program Learn the basics of VisualAge

With Project1 highlighted

Under Selected

Choose Add and then

Package . . .

Page 6: Lab 0 Objectives Input a basic Java Program Learn the basics of VisualAge

In the SmartGuide

Choose

Create a new package

Name it, say, welcome

Click Finish

Page 7: Lab 0 Objectives Input a basic Java Program Learn the basics of VisualAge

With welcome highlighted

Under Selected

Choose Add and then

Applet . . .

Page 8: Lab 0 Objectives Input a basic Java Program Learn the basics of VisualAge

In the SmartGuide

Add an Applet name,

WelcomeApplet

Click Japplet

Uncheck

Compose the class …

Click Finish

Page 9: Lab 0 Objectives Input a basic Java Program Learn the basics of VisualAge

Here is the Class Browser in Source mode (1st tab). Note that VisualAge has added the stubs of member functions for you.

Page 10: Lab 0 Objectives Input a basic Java Program Learn the basics of VisualAge

Click the Members tab; Click function paint(Graphics); Replace the code place holder with the g.drawString(…) code above.

Page 11: Lab 0 Objectives Input a basic Java Program Learn the basics of VisualAge

Click on any other function; click Yes in the text modified popup.

Page 12: Lab 0 Objectives Input a basic Java Program Learn the basics of VisualAge

Go back to the Workbench window.

Highlight

WelcomeApplet

Right click and choose Run and then In Applet Viewer

Page 13: Lab 0 Objectives Input a basic Java Program Learn the basics of VisualAge
Page 14: Lab 0 Objectives Input a basic Java Program Learn the basics of VisualAge

Part 2Copy the fig03_10 folder to your U: drive

In the Workbench highlight Project1

Choose File and then Import from a directory

Page 15: Lab 0 Objectives Input a basic Java Program Learn the basics of VisualAge

In the SmartGuide

Browse to the fig03_10 directory

.java and resource should be checked

Click Details and OK

Click Finish

Page 16: Lab 0 Objectives Input a basic Java Program Learn the basics of VisualAge

Note that a

Default package for Project1

has been added.

Highlight WelcomeLines

Run as before.

Page 17: Lab 0 Objectives Input a basic Java Program Learn the basics of VisualAge
Page 18: Lab 0 Objectives Input a basic Java Program Learn the basics of VisualAge

Part 3: Cleanup

First export your work.

In the Workbench under File choose Export and then directory

In the SmartGuide

Browse to the folder you want this stored in

Click Finish

Page 19: Lab 0 Objectives Input a basic Java Program Learn the basics of VisualAge

In the Workbench, highlight Project1

Right click and choose

Delete . . .

Delete your project.

Page 20: Lab 0 Objectives Input a basic Java Program Learn the basics of VisualAge

In the Workbench

Under Window

Choose

Repository Explorer

Page 21: Lab 0 Objectives Input a basic Java Program Learn the basics of VisualAge

In Repository Explorer

Click the Projects tab

Scroll to Project1

Right click and

Choose Purge . . .

Purge your project