Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lab07 submissions #15

Open
wants to merge 61 commits into
base: lab07branch
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
05f1126
Add updated version of SimpleGui1 to andrewberls src directory - done…
andrewberls Feb 13, 2014
17349c0
Simple drawings
andrewberls Feb 13, 2014
696a54e
Advanced drawings
andrewberls Feb 13, 2014
f32dd5a
Added updated version of SimpleGUI1 to my src directory - done with S…
rick-lee Feb 13, 2014
612e467
Added SimpleGui1.java and modified package name
dcoffill Feb 13, 2014
b190c1d
added updated version of SimpleGUI1 to my src directory - done with S…
OliverHKU Feb 13, 2014
477b688
Added updated version of SimpleGui1 to /src/ (finished step5)
thetomcraig Feb 13, 2014
821b75a
Updated SimpleGui1.java button color and text - Step 5
dcoffill Feb 13, 2014
28f9417
Copied .java files from pconrad/simple, added snowman's head, complet…
dcoffill Feb 13, 2014
57666ed
Added my own color and message to SimpleGui1.java
rtwaltman Feb 14, 2014
ad9462c
Created new Stickman drawing
rick-lee Feb 14, 2014
8cd1492
added updated SimpleGui1 to my src dir (Step 5)
Feb 14, 2014
db86075
added updated version of SimpleGUI1 to my src directory, done with St…
Feb 14, 2014
dbda4ef
Added the Snowman's Head (Finished Step 8)
Feb 15, 2014
cdc5b7c
Copied Files to my advanced folder (Step 9)
Feb 15, 2014
91dce19
Pizza and Pepperoni pizzas complete Step 11
Feb 16, 2014
1cb2b14
Create fish drawings in my advance, added a head to snowman
Feb 17, 2014
f35922b
Finished 3 drawings
Feb 17, 2014
68f76b0
Finished Eye adn EyeWithIris
thetomcraig Feb 17, 2014
80c0711
Updated README with javadoc link
thetomcraig Feb 17, 2014
6b8e83a
Finished going through checklist and test WPTF
Feb 17, 2014
f4336d9
Fixed README
Feb 18, 2014
b0aeeee
added updated version of SimpleGui1 to my src directory - Step 5
Feb 21, 2014
c3c8776
finished the simple part
sumersinha Feb 24, 2014
c4fe7e9
finished StereoWithButtons and Stereo class
sumersinha Feb 24, 2014
170ad82
adding both advanced and simple folders with complete working code vi…
rtwaltman Feb 26, 2014
6bb9c9f
Delete .bike.java.swp
rtwaltman Feb 26, 2014
798c11d
Added name to README.md
rtwaltman Feb 26, 2014
6e4b793
Reverted README.md to prevent conflict
rtwaltman Feb 26, 2014
3926f07
added updated version of SimpleGUI1 to my src directory - done with S…
davidacevedo Feb 26, 2014
6d0c872
Added top of snowman head in the simple drawing
davidacevedo Feb 26, 2014
6f50445
step 7 completed
Feb 28, 2014
74cc7dc
fixed snowman: step 8
Feb 28, 2014
b659d87
copied advanced files to kjih directory
Feb 28, 2014
103ce6f
Added and implemented Radio.java and RadioWithButtons.java
Feb 28, 2014
946b446
added updated version of SimpleGUI1 to my src directory - done with S…
Feb 28, 2014
37005d6
Changed package on all simple and advanced files, added head to snowm…
Feb 28, 2014
355dfeb
Created and Tested Glass and FullGlass
Feb 28, 2014
d2a70d4
copied *.java files from both advanced and simple directories from pc…
OliverHKU Feb 28, 2014
f121bba
all settled for this lab
OliverHKU Feb 28, 2014
c345724
lab06 final
sumersinha Feb 28, 2014
4292c2b
Added my own Donut class and SprinkledDonut class and changed AllMyDr…
davidacevedo Mar 1, 2014
d845ef7
Created Laptop and LaptopWithScreen classes, created drawings
dcoffill Mar 1, 2014
b12bf3f
Fixed minor bug with picture file writer
dcoffill Mar 1, 2014
d638651
Merge pull request #9 from sumersinha/master
andrewberls Mar 3, 2014
a432056
Merge pull request #8 from OliverHKU/master
andrewberls Mar 3, 2014
04c509d
Merge pull request #6 from kjih/master
andrewberls Mar 3, 2014
d5f8d6b
Merge pull request #5 from rtwaltman/master
andrewberls Mar 3, 2014
8aafa70
Merge pull request #4 from sdrhoads/master
andrewberls Mar 3, 2014
3d22c44
Merge pull request #3 from thetomcraig/master
andrewberls Mar 3, 2014
ec57f37
Merge pull request #2 from dwang68/master
andrewberls Mar 3, 2014
f02d2fc
Merge pull request #1 from rick-lee/master
andrewberls Mar 3, 2014
cd4076d
Merge branch 'lab07branch' of github.com:UCSB-CS56-W14/CS56-W14-lab06…
rick-lee Mar 6, 2014
6e71b1e
Merge pull request #10 from davidacevedo/master
andrewberls Mar 7, 2014
250b964
Merge pull request #7 from jgee67/master
andrewberls Mar 7, 2014
53cee34
Merge pull request #11 from dcoffill/master
andrewberls Mar 7, 2014
88872ee
Created animation of stickman with hat moving counterclockwise in a s…
rick-lee Mar 10, 2014
2ca6d32
Merge branch 'lab07branch' of github.com:UCSB-CS56-W14/CS56-W14-lab06…
davidacevedo Mar 15, 2014
05a37fc
added animation for myAnim
davidacevedo Mar 15, 2014
fc43fe3
Merge pull request #19 from davidacevedo/master
kjorg50 Mar 22, 2014
8de2e3e
Merge pull request #12 from rick-lee/lab07branch
pconrad Mar 23, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
CS56-W14-lab06
==============
Sidney Rhoads

http://www.cs.ucsb.edu/~sdrhoads/cs56/lab06/javadoc/

Public repo for CS56 W14 lab06

Tom Craig

Javadoc:
http://www.cs.ucsb.edu/~tomcraig/cs56/lab06/javadoc
8 changes: 4 additions & 4 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<property name="webRoot" value="${env.HOME}/public_html/cs56" />
<property name="webBaseURL" value="http://www.cs.ucsb.edu/~${env.USER}/cs56" />
<property name="projectName" value="lab06" />
<property name="projectName" value="CS56-W14-lab06" />
<property name="javadocDest" value="${webRoot}/${projectName}/javadoc" />
<property name="javadocURL" value="${webBaseURL}/${projectName}/javadoc" />
<property name="imagesDest" value="${webRoot}/${projectName}/images" />
Expand Down Expand Up @@ -229,7 +229,7 @@
<fileset dir="images"/>
</copy>

<echo>images/mypic1 online at ${imagesURL}/images/mypic1.png</echo>
<echo>images/mypic1 online at ${imagesURL}/mypic1.png</echo>
</target>

<target name="myWPTF2" depends="compile"
Expand All @@ -244,7 +244,7 @@
<fileset dir="images"/>
</copy>

<echo>images/mypic2 online at ${imagesURL}/images/mypic2.png</echo>
<echo>images/mypic2 online at ${imagesURL}/mypic2.png</echo>
</target>
<target name="myWPTF3" depends="compile"
description="run WritePictureToFile from my code;create images/mypic3">
Expand All @@ -258,7 +258,7 @@
<fileset dir="images"/>
</copy>

<echo>images/mypic3 online at ${imagesURL}/images/mypic3.png</echo>
<echo>images/mypic3 online at ${imagesURL}/mypic3.png</echo>
</target>


Expand Down
30 changes: 30 additions & 0 deletions src/edu/ucsb/cs56/W14/drawings/dalin/SimpleGui1.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package edu.ucsb.cs56.w14.drawings.dalin;
import javax.swing.*;

/** SimpleGui1 comes from Head First Java 2nd Edition p. 355.
It illustrates a simple GUI with a Button that doesn't do anything yet.

@author Head First Java, 2nd Edition p. 355
@author P. Conrad (who only typed it in and added the Javadoc comments)
@author TODO: Add additional author here
@version CS56, Spring 2013, UCSB
*/

public class SimpleGui1 {

/** main method to fire up a JFrame on the screen
@param args not used
*/

public static void main (String[] args) {
JFrame frame = new JFrame() ;
JButton button = new JButton("click me and I'll grant you three wishes") ;
java.awt.Color myColor = new java.awt.Color(250 , 2 , 38);
button.setBackground(myColor);
button.setOpaque(true);
frame. setDefaultCloseOperation(JFrame. EXIT_ON_CLOSE) ;
frame. getContentPane() . add(button) ;
frame. setSize(300,300) ;
frame. setVisible(true) ;
}
}
168 changes: 168 additions & 0 deletions src/edu/ucsb/cs56/W14/drawings/dalin/advanced/AllMyDrawings.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
package edu.ucsb.cs56.w14.drawings.dalin.advanced;

import java.awt.Graphics2D;
import java.awt.geom.Line2D; // single lines
import java.awt.geom.Ellipse2D; // ellipses and circles
import java.awt.geom.Rectangle2D; // for the bounding box
import java.awt.Rectangle; // squares and rectangles
import java.awt.geom.GeneralPath; // combinations of lines and curves
import java.awt.geom.AffineTransform; // translation, rotation, scale
import java.awt.Shape; // general class for shapes
import java.awt.Color; // class for Colors
import java.awt.Stroke;
import java.awt.BasicStroke;


import edu.ucsb.cs56.w14.drawings.utilities.ShapeTransforms;
import edu.ucsb.cs56.w14.drawings.utilities.GeneralPathWrapper;

/**
* A class with static methods for drawing various pictures
*
* @author Dalin Wang
* @version for CS56, lab06, W14
*/


public class AllMyDrawings
{
/** Draw a picture with some fish
*/

public static void drawPicture1(Graphics2D g2) {
//Draw a normal fish
Fish fish1 = new Fish(100 , 250 , 100 , 50);
g2.setColor(Color.black);
g2.draw(fish1);

//Draw another normal fish that's half the size and moves over 150 in -y direction
Shape fish2 = ShapeTransforms.scaledCopyOfLL(fish1,0.5,0.5);
fish2 = ShapeTransforms.translatedCopyOf(fish1,0,-150);
g2.setColor(Color.BLUE); g2.draw(fish2);

// This fish is 4x as big (2x the original)
// and moved over 150 pixels to right.
fish2 = ShapeTransforms.scaledCopyOfLL(fish2,3,3);
fish2 = ShapeTransforms.translatedCopyOf(fish2,150,100);

// We'll draw this with a thicker stroke
Stroke thick = new BasicStroke (4.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL);

Stroke orig=g2.getStroke();
g2.setStroke(thick);
g2.setColor(new Color(0x002FA7));
g2.draw(fish2);

//Draw a swordfish with a longbill

Swordfish sfish1 = new Swordfish(300 , 250 , 100 , 50);
Swordfish sfish2 = new Swordfish(300 , 300 , 240 , 120);
g2.setColor(Color.red);
g2.draw(sfish1);

g2.setColor(new Color(0x8F00FF));
g2.draw(sfish2);


g2.setStroke(orig);
g2.setColor(Color.BLACK);
g2.drawString("Some fish by Dalin Wang", 20,20);



}





/** Draw a tank of some fish and swordfish
*/
public static void drawPicture2(Graphics2D g2) {

// Draw some fish.

Fish fish1 = new Fish(100 , 100 , 50 , 25);
Fish fish2 = new Fish(200 , 250 , 150 , 75);
Fish fish3 = new Fish(200 , 100 , 100 , 50);
Fish fish4 = new Fish(300 , 350 , 200 , 100);


g2.setColor(Color.RED); g2.draw(fish1);
g2.setColor(Color.GREEN); g2.draw(fish2);
g2.setColor(Color.BLUE); g2.draw(fish3);
g2.setColor(Color.MAGENTA); g2.draw(fish4);



// We'll draw this with a thicker stroke
Stroke thick = new BasicStroke (4.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL);

// for hex colors, see (e.g.) http://en.wikipedia.org/wiki/List_of_colors
// #002FA7 is "International Klein Blue" according to Wikipedia
// In HTML we use #, but in Java (and C/C++) its 0x

Swordfish sfish1 = new Swordfish(360 , 100 , 100 , 50);
Stroke orig=g2.getStroke();
g2.setStroke(thick);
g2.setColor(new Color(0x002FA7));
g2.draw(sfish1);



// Rotate the fish 180 degrees around its center.
Shape fish5 = ShapeTransforms.rotatedCopyOf(fish2, Math.PI);
fish5 = ShapeTransforms.translatedCopyOf(fish5, 200 , 0);
g2.draw(fish5);

// @@@ FINALLY, SIGN AND LABEL YOUR DRAWING

g2.setStroke(orig);
g2.setColor(Color.BLACK);
g2.drawString("A bunch of fish and swordfish by Dalin Wang", 20,20);
}

/** Draw a a group of 8 fish and swordfish
*/

public static void drawPicture3(Graphics2D g2) {

// label the drawing


g2.drawString("A group four fish in love by Dalin Wang", 20,20);



// Draw some fish.

Fish fish1 = new Fish(200,300,200,100);

g2.setColor(Color.RED); g2.draw(fish1);


Shape fish2 = ShapeTransforms.rotatedCopyOf(fish1, 0.5 * Math.PI);

fish2 = ShapeTransforms.translatedCopyOf(fish2, 125 , -150 );

g2.setColor(Color.BLUE); g2.draw(fish2);


Shape fish3 = ShapeTransforms.rotatedCopyOf(fish1, 1 * Math.PI);

fish3 = ShapeTransforms.translatedCopyOf(fish3 , 250 , 0);

g2.setColor(Color.PINK); g2.draw(fish3);


Shape fish4 = ShapeTransforms.rotatedCopyOf(fish1, 1.5 * Math.PI);

fish4 = ShapeTransforms.translatedCopyOf(fish4, 125 , 150 );

g2.setColor(Color.ORANGE); g2.draw(fish4);


}


}
96 changes: 96 additions & 0 deletions src/edu/ucsb/cs56/W14/drawings/dalin/advanced/CoffeeCup.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
package edu.ucsb.cs56.w14.drawings.dalin.advanced;
import java.awt.geom.GeneralPath; // combinations of lines and curves
import java.awt.geom.AffineTransform; // translation, rotation, scale
import java.awt.Shape; // general class for shapes

// all imports below this line needed if you are implementing Shape
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.awt.Rectangle;
import java.awt.geom.PathIterator;
import java.awt.geom.AffineTransform;

import edu.ucsb.cs56.w14.drawings.utilities.ShapeTransforms;
import edu.ucsb.cs56.w14.drawings.utilities.GeneralPathWrapper;

/**
A Coffee Cup (wrapper around a General Path, implements Shape)

This provides an example of how you can start with the coordinates
of a hard coded object, and end up with an object that can be
drawn anywhere, with any width or height.


@author Phill Conrad
@version for CS56, W11, UCSB, 02/23/2011

*/
public class CoffeeCup extends GeneralPathWrapper implements Shape
{


/**
* Constructor for objects of class CoffeeCup
*/
public CoffeeCup(double x, double y, double width, double height)
{

// Specify the upper left corner, and the
// width and height of the original points used to
// plot the *hard-coded* coffee cup

final double ORIG_ULX = 100.0;
final double ORIG_ULY = 100.0;
final double ORIG_HEIGHT = 300.0;
final double ORIG_WIDTH = 400.0;

GeneralPath leftSide = new GeneralPath();

// left side of cup

leftSide.moveTo(200,400);
leftSide.lineTo(160,360);
leftSide.lineTo(130,300);
leftSide.lineTo(100,200);
leftSide.lineTo(100,100);

GeneralPath topAndBottom = new GeneralPath();

topAndBottom.moveTo(100,100);
topAndBottom.lineTo(500,100); // top of cup

topAndBottom.moveTo(200,400);
topAndBottom.lineTo(400,400); // bottom of cup

Shape rightSide = ShapeTransforms.horizontallyFlippedCopyOf(leftSide);

// after flipping around the upper left hand corner of the
// bounding box, we move this over to the right by 400 pixels

rightSide = ShapeTransforms.translatedCopyOf(rightSide, 400.0, 0.0);

// now we put the whole thing together ino a single path.

GeneralPath wholeCup = new GeneralPath ();
wholeCup.append(topAndBottom, false);
wholeCup.append(leftSide, false);
wholeCup.append(rightSide, false);

// translate to the origin by subtracting the original upper left x and y
// then translate to (x,y) by adding x and y

Shape s = ShapeTransforms.translatedCopyOf(wholeCup, -ORIG_ULX + x, -ORIG_ULY + y);

// scale to correct height and width
s = ShapeTransforms.scaledCopyOf(s,
width/ORIG_WIDTH,
height/ORIG_HEIGHT) ;

// Use the GeneralPath constructor that takes a shape and returns
// it as a general path to set our instance variable cup

this.set(new GeneralPath(s));

}

}
Loading