Download 1) Submit BusinessCard.java and bcard.html on Canvas. 2) Copy

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
CS 171G – Fall 2012
Lab 5
Graphics with Java
You will use JGrasp to edit, compile and test your programs.
25 points possible.
1) Submit BusinessCard.java and bcard.html on Canvas.
2) Copy BusinessCard.class and bcard.html to your public_html folder on the
NMSU web server. Change/Fix permissions to make them viewable to the
world.
Materials related to this assignment can be found in
the "Graphics" Module on Canvas.
At the top of each program include comments with your name, CS 171G, and a brief description of
what the program does.
Create BusinessCard.java
BusinessCard.java will be a Java applet. Open JGrasp. You can start with Olympic.java and
make changes to it OR you can create a new Java program and start fresh.
Remember that punctuation symbols such as parentheses, quotation marks, brackets, and curly
braces must come in pairs.
1. Design your own business card. Your business card should be your own unique design.
Include your name, your business name, and a small icon (some recognizable picture) on
the card. You may also include other text on the card if you wish.
2. Write a Java applet to draw your business card design. The "card" applet should be at
least 500 pixels wide and 300 pixels high but no more than 1000 x 700 pixels.
You must use a minimum of 3 different built-in colors and 1 custom color (a color that you
create), with at least one of each of these drawing commands:
- drawRect or fillRect
- drawOval or fillOval
- drawLine
- drawString
- drawArc or fillArc
You must have a repeating border on the top, bottom, left and right of your business card.
3. Edit your program in JGrasp and save it with the filename BusinessCard.java.
4. Compile the program. Fix any syntax errors. Compile again. Repeat until no syntax errors.
Remember that the compiler is going to create a bytecode file for you. The name of the
bytecode file will be BusinessCard.class.
The bytecode file is "portable". It can be moved from one type of computer to another
without any compatibility issues.
5. Display the applet with appletviewer. The appletviewer window may not be big enough to
display your entire business card. If it's too small, just drag the bottom-right corner of the
window to make it big enough.
6.
If it doesn't look the way you want it to, make changes, save, compile, view again...repeat.
*** CLOSE ALL FILES BEFORE EXITING FROM JGRASP ***
Create bcard.html
1. Using Notepad or other text editor, create a file called bcard.html. Enter the following 4
lines in the file:
<html>
<applet code="BusinessCard.class" width=500 height=300>
</applet>
</html>
2. Note: If you made your business card bigger than the minimum size of 500 x 300, you will
need to change the width and height in the html code.
3. Save bcard.html in the same folder as your BusinessCard.java file.
4. Using WinSCP, copy BusinessCard.class and bcard.html to your public_html folder on
the NMSU web server. Change/Fix permissions to make them viewable to the world.
5. Verify that your applet is visible on the web server. In your web browser, use the address
http://web.nmsu.edu/~yourusername/bcard.html
Submit BusinessCard.java and bcard.html on Canvas.
For full credit, your business card web page and applet must
be viewable on the NMSU web server.