Computer Science 523
Advanced Programming
Summer 2014, The College of Saint Rose
This first "mini" lab is designed to help you get set up with BlueJ, a simple integrated development environment (IDE). After this lab, you will not be required to use BlueJ, but I want everyone to be familiar with it, as I will be using it for my own in-class development, and class examples and lab sample solutions will be distributed as BlueJ projects.
You are to work alone on this lab, but please feel free to ask for as much help as you need from your instructor and/or classmates.
Introduction and Setup
There are two major types of programs we will be developing this semester: Java applets and Java applications. More soon on the differences between them and when we'll use each, but for now we will work through an exercise to run one of each in BlueJ.
It is important to keep up - ask if you are having trouble at any step. For today, everyone should use one of the lab computers. If you would like to use your own computer later, we will see soon how to set that up. It's all free software, available for any computer that can run Java.
Important note: be sure to get into the habit of naming your folders and files for this course without any spaces. Spaces in the names can cause a variety of problems later.
Running a Java Application
First, we'll run a Java application in BlueJ. These are programs that interact with you through the keyboard and screen (the "terminal").
System.out.println("Hello, Java application world");
@author
with your name. There is no need to leave
the parentheses. Re-compile (the "Compile" button) and re-run to
make sure it still works.
Running a Java Applet
Next, we will see how to run a Java Applet in BlueJ. Applets are programs that interact with their users through one or more graphical user interface screens (buttons, menus, text fields, etc.). These types of programs can be run in a standalone mode, but are often run by embedding them in web pages.
import java.awt.*; import javax.swing.*;
And then in the class header, add "extends JApplet", making your class header
public class HelloWorldApplet extends JApplet
{
and }
, type the following method definition,
exactly as you see it here, including all spacing and punctuation:
public void init() { add(new JLabel("Hello, Java Applet world!")); }
Creating and Submitting an Archive File
Your last task is to create a single archive file that you can submit through our SubmissionBox system. In Windows, you can do this by choosing the "7z" option or the option to create a "Zip Archive" when you right click on a folder. Navigate to your "H:" drive in the Windows Explorer, and go into your "CS523" folder. Create a Zip archive of your "Lab0" folder that contains the Java programs you just wrote.
To submit, Upload a copy of your lab (the .7z or .zip file you just created that contains your project directory) using Submission Box under assignment "Lab0".
Grading
This assignment is worth 10 points, which are distributed as follows:
> Feature | Value | Score |
Working HelloWorldApplication | 2 | |
Working HelloWorldApplet | 2 | |
Class comment and name in each file | 2 | |
Formatting of each file | 2 | |
Proper .7z or .zip archive submitted | 2 | |
Total | 10 | |