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

Preview:

Citation preview

Lab 0

ObjectivesInput 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.

Open VisualAge

Under Selected

Choose Add and then

Project . . .

Part 1

In the SmartGuide

Choose

Create a new project

Name it, say, Project1

Click Finish

With Project1 highlighted

Under Selected

Choose Add and then

Package . . .

In the SmartGuide

Choose

Create a new package

Name it, say, welcome

Click Finish

With welcome highlighted

Under Selected

Choose Add and then

Applet . . .

In the SmartGuide

Add an Applet name,

WelcomeApplet

Click Japplet

Uncheck

Compose the class …

Click Finish

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

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

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

Go back to the Workbench window.

Highlight

WelcomeApplet

Right click and choose Run and then In Applet Viewer

Part 2Copy the fig03_10 folder to your U: drive

In the Workbench highlight Project1

Choose File and then Import from a directory

In the SmartGuide

Browse to the fig03_10 directory

.java and resource should be checked

Click Details and OK

Click Finish

Note that a

Default package for Project1

has been added.

Highlight WelcomeLines

Run as before.

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

In the Workbench, highlight Project1

Right click and choose

Delete . . .

Delete your project.

In the Workbench

Under Window

Choose

Repository Explorer

In Repository Explorer

Click the Projects tab

Scroll to Project1

Right click and

Choose Purge . . .

Purge your project

Recommended