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 #13

Open
wants to merge 87 commits into
base: lab07branch
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
8c50f71
Step 5: done
kmai12 Feb 13, 2014
8c8716d
added updated version of SimpleGUI1 to my src directory - done with S…
Feb 13, 2014
61eac6a
copied SimpleGui1.java and personalized the widget
Feb 14, 2014
5e763dd
Added head object to snowman
Feb 14, 2014
6f1631d
added jrcryan sibling directory (done with step 7)
jennacryan Feb 14, 2014
85ee1fe
Finished lab
kmai12 Feb 15, 2014
42ca2b9
added updated version of SimpleGUI1 to my src directory - done with S…
andrewpang Feb 15, 2014
5e7177b
added updated version of SimpleGui1 yo my src directory - done with S…
jennyvien Feb 16, 2014
8239fe8
added updated version of SimpleGui1 to my src directory - done with S…
jennyvien Feb 16, 2014
2d37dea
added updated version of SimpleGUI1 to my src directory - done with S…
bzimm Feb 17, 2014
25fe0da
added updated version of SimpleGui1 to my src dir - done with step5
bernardyan Feb 17, 2014
a049ae6
added updated version of SimpleGui1 to my src directory - done with S…
Migueld37 Feb 18, 2014
682da3e
added updated version of SimpleGUI1 to my src directory - done with S…
Feb 18, 2014
e96acce
rabbit looks retarded
jovo123 Feb 20, 2014
6bfb445
rabbit doesn't suck anymore
jovo123 Feb 20, 2014
5d92f36
copied files & changed package names in advanced (done with step 9)
jennacryan Feb 20, 2014
355a8dc
Fixed snowman head
andrewpang Feb 21, 2014
b91dadd
Finished
Feb 21, 2014
c9ce399
Created folders
Feb 22, 2014
27edd71
Added Plate and coolPlate classes
andrewpang Feb 22, 2014
abbf907
Finished AllMyDrawings
andrewpang Feb 22, 2014
34b4331
Changes to javadoc
andrewpang Feb 22, 2014
d6f9594
Finished Step 11
jennyvien Feb 23, 2014
9eeb0e8
Fixed WPTF file
andrewpang Feb 23, 2014
74ce357
added my subdirectory and copied in the simple gui file
krbriggs Feb 24, 2014
4985f7c
added the snowman's head
krbriggs Feb 24, 2014
7c2f24d
Added Flag.java
Migueld37 Feb 24, 2014
748a54b
made the santa hat, still have to make santa with the hat
krbriggs Feb 24, 2014
01ee6a2
Modified the three methods to my classes
Migueld37 Feb 24, 2014
46a9c5f
Added simple directory to repo
Migueld37 Feb 24, 2014
34db133
finished the santawithhat implementation and the code that draws these
krbriggs Feb 26, 2014
fa437b3
made Popsicle and PopsicleOnAStick classes for contructing drawings
jennacryan Feb 27, 2014
89d15fc
ready to be pulled
bernardyan Feb 27, 2014
72abe59
finished my drawings
Nazgugu Feb 27, 2014
bff963d
added simple gui
Nazgugu Feb 27, 2014
616415b
created drawings and added comments/javadoc
bzimm Feb 27, 2014
7edf435
added updated version of SimpleGUI1 to my src directory - done with S…
christopherluo Feb 27, 2014
752b22a
Created Pie, ApplePie classes, new testing functions for these drawings
Feb 28, 2014
116e862
Changed some comments, indents
Feb 28, 2014
8285dd4
Minor comment changes
Feb 28, 2014
2b5ccf3
Update ApplePie.java
Feb 28, 2014
686b190
added updated version of SimpleGUI1 to my src directory - done with S…
acantor Feb 28, 2014
ddea43b
Fixed Apple.java
Feb 28, 2014
5187a64
Fixed the snowman
acantor Feb 28, 2014
6d19907
fixed drawings, updated some comments
jennacryan Feb 28, 2014
e937002
added updated version of SImpleGUI1 to my src directory - done with s…
108498asdf Feb 28, 2014
4680db0
finished lab06
108498asdf Feb 28, 2014
999e185
changed readme
108498asdf Feb 28, 2014
7a66b9f
my drawings
acantor Feb 28, 2014
1738510
fixed comments
acantor Feb 28, 2014
42d99a0
Added Camera and CameraWithStand classes and drew them
Feb 28, 2014
63627cf
Fixed CameraWithStand
Feb 28, 2014
aeaf0b6
final changes
christopherluo Mar 1, 2014
680ddde
Merge branch 'lab07branch' of github.com:UCSB-CS56-W14/CS56-W14-lab06…
kmai12 Mar 6, 2014
9a500d8
Animation
kmai12 Mar 6, 2014
cf591f2
Merge pull request #16 from christopherluo/master
Mar 7, 2014
57c1264
Added a second star/thread
kmai12 Mar 7, 2014
b3e3211
Merge pull request #15 from ericchen94/master
Mar 7, 2014
ca94969
Merge pull request #14 from acantor/master
Mar 7, 2014
bdbe99f
Merge pull request #11 from bzimm/master
Mar 7, 2014
3a0e172
Merge pull request #10 from zhansaya19/master
Mar 7, 2014
068e6d2
Merge pull request #9 from Migueld37/master
Mar 7, 2014
da05b96
Merge pull request #8 from Nazgugu/master
Mar 7, 2014
4415dc3
Merge pull request #6 from krbriggs/master
Mar 7, 2014
064c50d
Merge pull request #7 from bernardyan/master
Mar 7, 2014
19475a4
Merge pull request #5 from andrewpang/master
Mar 7, 2014
0233885
Merge pull request #4 from jennyvien/master
Mar 7, 2014
d2949ae
Merge pull request #3 from bhammel/master
Mar 7, 2014
f7934d3
Merge pull request #2 from jovo123/master
Mar 7, 2014
01eeb2d
Merge pull request #1 from kmai12/master
Mar 7, 2014
30fae84
Delete README.md
108498asdf Mar 7, 2014
fe389dd
Create README.md
108498asdf Mar 7, 2014
94853ee
reverted changes to README
jennacryan Mar 7, 2014
4d6ee0d
Merge pull request #12 from jrcryan/master
Mar 8, 2014
cab1bff
Update build.xml
108498asdf Mar 8, 2014
1b4d199
Merge pull request #13 from 108498asdf/master
Mar 8, 2014
99c5c5b
merging
acantor Mar 11, 2014
e710fd4
myAnim complete
acantor Mar 11, 2014
1024ca1
added animation
christopherluo Mar 14, 2014
2fbb9fc
Added animation
Mar 14, 2014
5d31b5c
added animation that makes the santa go up and down and randomly chan…
krbriggs Mar 14, 2014
f70fec5
Merge pull request #24 from ericchen94/lab07branch
pconrad Mar 18, 2014
fb7be4b
fixed problem in ericchen PictureComponent.java (did not have Circle.…
pconrad Mar 18, 2014
643270c
Merge pull request #23 from krbriggs/lab07branch
kjorg50 Mar 22, 2014
77bbac8
Merge pull request #22 from christopherluo/lab07branch
kjorg50 Mar 22, 2014
130f071
Merge pull request #25 from kmai12/lab07branch
kjorg50 Mar 22, 2014
407afd3
Merge pull request #18 from acantor/lab07branch
kjorg50 Mar 22, 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*#
*~
javadoc/
build/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CS56-W14-lab06
==============

Public repo for CS56 W14 lab06
Public repo for CS56 W14 lab06
30 changes: 30 additions & 0 deletions src/edu/ucsb/cs56/W14/drawings/andrewpang/SimpleGui1.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package edu.ucsb.cs56.w14.drawings.andrewpang;
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 Andrew Pang
@version CS56, Winter 2014, 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("Do not click me, jk!") ;
java.awt.Color myColor = new java.awt.Color(204,255,153); // R, G, B values.
button.setBackground(myColor);
button.setOpaque(true);
frame. setDefaultCloseOperation(JFrame. EXIT_ON_CLOSE) ;
frame. getContentPane() . add(button) ;
frame. setSize(300,300) ;
frame. setVisible(true) ;
}
}
140 changes: 140 additions & 0 deletions src/edu/ucsb/cs56/W14/drawings/andrewpang/advanced/AllMyDrawings.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
package edu.ucsb.cs56.w14.drawings.andrewpang.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 Andrew Pang
* @version for CS56, W14, lab06
*/


public class AllMyDrawings
{

public static void drawPicture1(Graphics2D g2) {

Plate p1 = new Plate(100,100,50);
g2.setColor(Color.BLACK); g2.draw(p1);

Shape p2 = ShapeTransforms.scaledCopyOfLL(p1,0.25,0.25);
p2 = ShapeTransforms.translatedCopyOf(p2,150,50);
g2.setColor(Color.RED); g2.draw(p2);

p2 = ShapeTransforms.scaledCopyOfLL(p2,10,10);
p2 = ShapeTransforms.translatedCopyOf(p2,150,75);

// 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

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

coolPlate p3 = new coolPlate(150,250,70);
coolPlate p4 = new coolPlate(270,350,110);
g2.draw(p3);
g2.setColor(Color.GREEN);
g2.draw(p4);

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

g2.setStroke(orig);
g2.setColor(Color.BLACK);
g2.drawString("A few plates by Andrew Pang", 20,20);



}


public static void drawPicture2(Graphics2D g2) {

coolPlate p1 = new coolPlate(320,220,200);
g2.setColor(Color.ORANGE); g2.draw(p1);

Shape p2 = ShapeTransforms.scaledCopyOfLL(p1,0.75,1);
p2 = ShapeTransforms.translatedCopyOf(p2,-150,50);
g2.setColor(Color.RED); g2.draw(p2);

Shape p3 = ShapeTransforms.scaledCopyOfLL(p1,0.75,0.25);
p3 = ShapeTransforms.translatedCopyOf(p3,150,20);
g2.setColor(Color.GRAY); g2.draw(p3);

Stroke thick = new BasicStroke (4.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL);
Stroke orig=g2.getStroke();
g2.setStroke(thick);
g2.setColor(Color.MAGENTA);

Plate p4 = new Plate(250,250,70);
Shape p5 = ShapeTransforms.scaledCopyOfLL(p4,.6,.2);
p5 = ShapeTransforms.translatedCopyOf(p5,100,70);
g2.draw(p4);
g2.setColor(Color.PINK);
g2.draw(p5);

Shape p6 = ShapeTransforms.rotatedCopyOf(p1, Math.PI/4.0);
g2.setColor(Color.ORANGE);
g2.setStroke(orig);
g2.draw(p6);
// @@@ FINALLY, SIGN AND LABEL YOUR DRAWING


g2.setColor(Color.BLACK);
g2.drawString("A bunch of different plates by Andrew Pang", 20,20);
}

public static void drawPicture3(Graphics2D g2) {

// label the drawing

g2.drawString("A few wierd plates by Andrew Pang", 20,20);

coolPlate p1 = new coolPlate(220,220,100);
g2.setColor(Color.BLUE); g2.draw(p1);

Shape p2 = ShapeTransforms.rotatedCopyOf(p1, Math.PI/8.0);
Shape p3 = ShapeTransforms.rotatedCopyOf(p2, Math.PI/8.0);
Shape p4 = ShapeTransforms.rotatedCopyOf(p3, Math.PI/8.0);
g2.draw(p2); g2.draw(p3); g2.draw(p4);

g2.setColor(Color.RED);
Shape p5 = ShapeTransforms.scaledCopyOfLL(p1,1.25,1.25);
p5 = ShapeTransforms.translatedCopyOf(p5,150,20);
g2.draw(p5);
Shape p6 = ShapeTransforms.scaledCopyOfLL(p2,1.25,1.25);
p6 = ShapeTransforms.translatedCopyOf(p6,150,20);
g2.draw(p6);
Shape p7 = ShapeTransforms.scaledCopyOfLL(p3,1.25,1.25);
p7 = ShapeTransforms.translatedCopyOf(p7,150,20);
g2.draw(p7);
Shape p8 = ShapeTransforms.scaledCopyOfLL(p4,1.25,1.25);
p8 = ShapeTransforms.translatedCopyOf(p8,150,20);
g2.draw(p8);

Plate p9 = new Plate(320,220,200);
g2.setColor(Color.MAGENTA); g2.draw(p9);
}


}
96 changes: 96 additions & 0 deletions src/edu/ucsb/cs56/W14/drawings/andrewpang/advanced/CoffeeCup.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
package edu.ucsb.cs56.w14.drawings.andrewpang.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));

}

}
76 changes: 76 additions & 0 deletions src/edu/ucsb/cs56/W14/drawings/andrewpang/advanced/House.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package edu.ucsb.cs56.w14.drawings.andrewpang.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.Line2D;
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 vector drawing of a house that implements
the Shape interface, and so can be drawn, as well as
rotated, scaled, etc.

@author Phill Conrad
@version for CS56, Winter 11, UCSB

*/
public class House extends GeneralPathWrapper implements Shape
{
/**
Constructor

@param x x coord of lower left corner of house
@param y y coord of lower left corner of house
@param width width of the house
@param height of house (including first story and second story)
*/
public House(double x, double y, double width, double height)
{

// Rather than having to scale at the end, we can just
// draw things the right way to begin with, using the
// x, y, width and height. If you haven't already
// hard coded a particular drawing, this may be an easier
// way.

double firstStoryHeight = .75 * height;
double roofHeight = height - firstStoryHeight;

double firstStoryUpperLeftY = y + roofHeight;

// Make the first story

Rectangle2D.Double firstStory =
new Rectangle2D.Double(x, firstStoryUpperLeftY ,
width, firstStoryHeight);

// make the roof. Remember that y goes DOWN the page,
// so we ADD to y to get a "lower" value on the screen

Line2D.Double leftRoof =
new Line2D.Double (x, y + roofHeight,
x + width/2.0, y);

Line2D.Double rightRoof =
new Line2D.Double (x + width/2.0, y,
x + width, y + roofHeight);

// put the whole house together

GeneralPath wholeHouse = this.get();
wholeHouse.append(firstStory, false);
wholeHouse.append(leftRoof, false);
wholeHouse.append(rightRoof, false);

}

}
Loading