-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
207 additions
and
21 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#BlueJ class context | ||
comment0.params= | ||
comment0.target=Example() | ||
comment0.text=\n\ Creates\ a\ new\ Example\ object.\n | ||
numComments=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
import student.*; | ||
|
||
// ------------------------------------------------------------------------- | ||
/** | ||
* Write a one-sentence summary of your class here. | ||
* Follow it with additional details about its purpose, what abstraction | ||
* it represents, and how to use it. | ||
* | ||
* @author your-pid (and if in lab, partner's pid on same line) | ||
* @version (place the date here, in this format: yyyy.mm.dd) | ||
*/ | ||
public class Example | ||
{ | ||
//~ Instance/static variables ............................................. | ||
|
||
|
||
|
||
//~ Constructor ........................................................... | ||
|
||
// ---------------------------------------------------------- | ||
/** | ||
* Creates a new Example object. | ||
*/ | ||
public Example() | ||
{ | ||
/*# Do any work to initialize your class here. */ | ||
} | ||
|
||
|
||
//~ Methods ............................................................... | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
#BlueJ class context | ||
comment0.params=args | ||
comment0.target=void\ main(java.lang.String[]) | ||
numComments=1 | ||
comment1.params= | ||
comment1.target=void\ maxGreen() | ||
numComments=2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,49 @@ | ||
#BlueJ package file | ||
package.editor.height=400 | ||
package.editor.width=560 | ||
package.editor.x=520 | ||
package.editor.y=155 | ||
package.editor.height=739 | ||
package.editor.width=1101 | ||
package.editor.x=59 | ||
package.editor.y=22 | ||
package.numDependencies=0 | ||
package.numTargets=2 | ||
package.numTargets=3 | ||
package.showExtends=true | ||
package.showUses=true | ||
project.charset=UTF-8 | ||
readme.editor.height=700 | ||
readme.editor.width=900 | ||
readme.editor.x=518 | ||
readme.editor.x=380 | ||
readme.editor.y=199 | ||
target1.editor.height=700 | ||
target1.editor.width=900 | ||
target1.editor.x=492 | ||
target1.editor.y=103 | ||
target1.editor.x=97 | ||
target1.editor.y=42 | ||
target1.height=50 | ||
target1.name=MaxRed | ||
target1.name=Example | ||
target1.naviview.expanded=true | ||
target1.showInterface=false | ||
target1.type=ClassTarget | ||
target1.width=80 | ||
target1.x=160 | ||
target1.y=10 | ||
target1.x=380 | ||
target1.y=190 | ||
target2.editor.height=700 | ||
target2.editor.width=900 | ||
target2.editor.x=540 | ||
target2.editor.y=175 | ||
target2.editor.x=380 | ||
target2.editor.y=103 | ||
target2.height=50 | ||
target2.name=Hello | ||
target2.naviview.expanded=true | ||
target2.name=MaxRed | ||
target2.showInterface=false | ||
target2.type=ClassTarget | ||
target2.width=80 | ||
target2.x=70 | ||
target2.x=160 | ||
target2.y=10 | ||
target3.editor.height=700 | ||
target3.editor.width=900 | ||
target3.editor.x=260 | ||
target3.editor.y=39 | ||
target3.height=50 | ||
target3.name=Hello | ||
target3.naviview.expanded=true | ||
target3.showInterface=false | ||
target3.type=ClassTarget | ||
target3.width=80 | ||
target3.x=70 | ||
target3.y=10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
------------------------------------------------------------------------ | ||
This is the project README file. Here, you should describe your project. | ||
Tell the reader (someone who does not know anything about this project) | ||
all he/she needs to know. The comments should usually include at least: | ||
------------------------------------------------------------------------ | ||
|
||
Project Title: | ||
Author(s): | ||
Date: | ||
|
||
Purpose | ||
======= | ||
|
||
|
||
|
||
How to Start This Project | ||
========================= | ||
|
||
|
||
|
||
User Instructions | ||
================= |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#BlueJ class context | ||
comment0.params= | ||
comment0.target=TintablePicture() | ||
comment0.text=\n\ Creates\ a\ new\ TintablePicture\ object.\n | ||
comment1.params= | ||
comment1.target=void\ tintPicture() | ||
comment2.params=tintColor | ||
comment2.target=void\ tintPicture(java.awt.Color) | ||
comment3.params=p\ c | ||
comment3.target=void\ tintPixel(Pixel,\ java.awt.Color) | ||
comment4.params=c1\ c2 | ||
comment4.target=double\ distance(java.awt.Color,\ java.awt.Color) | ||
numComments=5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
|
||
import student.*; | ||
import java.awt.Color; | ||
|
||
// ------------------------------------------------------------------------- | ||
/** | ||
* Write a one-sentence summary of your class here. | ||
* Follow it with additional details about its purpose, what abstraction | ||
* it represents, and how to use it. | ||
* | ||
* @author your-pid (and if in lab, partner's pid on same line) | ||
* @version (place the date here, in this format: yyyy.mm.dd) | ||
*/ | ||
public class TintablePicture extends Picture | ||
{ | ||
//~ Instance/static variables ............................................. | ||
|
||
|
||
|
||
//~ Constructor ........................................................... | ||
|
||
// ---------------------------------------------------------- | ||
/** | ||
* Creates a new TintablePicture object. | ||
*/ | ||
public TintablePicture() | ||
{ | ||
/*# Do any work to initialize your class here. */ | ||
this.load(FileChooser.pickAFile()); | ||
} | ||
|
||
public void tintPicture() | ||
{ | ||
this.tintPicture(ColorChooser.pickAColor()); | ||
} | ||
public void tintPicture(Color tintColor) | ||
{ | ||
Pixel[] pixels = this.getPixels(); | ||
for (int i = 0; i < pixels.length; i++) | ||
{ | ||
this.tintPixel(pixels[i], tintColor); | ||
} | ||
} | ||
|
||
public void tintPixel(Pixel p, Color c) | ||
{ | ||
double newRed = p.getRed()/2 + c.getRed()/2; | ||
double newGreen = p.getGreen()/2 + c.getGreen()/2; | ||
double newBlue = p.getBlue()/2 + c.getBlue()/2; | ||
System.out.println(newRed + " " + newGreen + " " + newBlue); | ||
p.setColor(new Color((int)newRed, (int)newGreen, (int)newBlue)); | ||
} | ||
|
||
//~ Methods ............................................................... | ||
public double distance(Color c1, Color c2) | ||
{ | ||
double red = Math.pow(c1.getRed()-c2.getRed(),2); | ||
double green = Math.pow(c1.getGreen()-c2.getGreen(),2); | ||
double blue = Math.pow(c1.getBlue()-c2.getBlue(),2); | ||
double radicand = red + green + blue; | ||
|
||
return Math.sqrt(radicand); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#BlueJ package file | ||
package.editor.height=400 | ||
package.editor.width=560 | ||
package.editor.x=79 | ||
package.editor.y=42 | ||
package.numDependencies=0 | ||
package.numTargets=1 | ||
package.showExtends=true | ||
package.showUses=true | ||
project.charset=UTF-8 | ||
target1.editor.height=700 | ||
target1.editor.width=900 | ||
target1.editor.x=333 | ||
target1.editor.y=38 | ||
target1.height=50 | ||
target1.name=TintablePicture | ||
target1.showInterface=false | ||
target1.type=ClassTarget | ||
target1.width=120 | ||
target1.x=70 | ||
target1.y=10 |