Change Contents of the Bubble
View this PageEdit this PageUploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Questions on HW2-Fall2005

Got questions about making a picture collage in Java?

Ask 'em here!


I know that you said that it would be too easy for us to do a collage for hw 2. I thought that you had said that you were going to change it to something else. Should we still do a picture collage?
Kyle DuPont

I didn't have you do an AUDIO collage. HW2 is definitely a PICTURE collage. Mark Guzdial

Can you explain the 'main' part a bit more. Whenever I compile it, it says that it expects a "(" on that line, so it is with error. Also assuming that my code is correct, he program should run and show the collage by just typing in pictureCollage() correct?
Kyle DuPont

Kyle, I'll go over the main method in recitation today (Sep 12). #4

Which line, Kyle? No, you should run your main() by choosing to "Run the Document's Main Method" under the Tools menu. Mark Guzdial

for some reason I am having a weird time saving(writing) my pictures to file. it keeps giving me this error...TokenMgrError: Lexical error at line 1, column 13. Encountered: "P" (80), after : "C:\

what is it trying to tell me?
Removed at KS request


Krista, try changing the backslashes ("\") to forward slashes ("/"). The backslash is a special character when put in a string and it looks like it's causing a syntax error. #4



what does this mean?
IllegalArgumentException: Color parameter outside of expected range: Red

Removed at KS request

Krista, the red, green, blue values must be integers between 0 and 255, inclusive. If that's not your problem, then you'll have to be more specific. #4


For the pictures other than the original, can they be manipulated with the same method? For example, Perry and I scaled our pictures to different sizes.
Student159

Sure! Mark Guzdial

can i make a canvas that is colored? i tried doing it by

new Picture(700,390);
canvasPicture.setColor(Red);

but that did not work. Is this possible?

Is it possible to fill the canvas with a color? Absolutely. But we don't give you a pre-defined method to do it. If you want to fill with a color, you'll have to define a method to do it – which really shouldn't be hard for you. Mark Guzdial

how do we write out to save our picture?

you write it out with:
p.write("c:/filepath/picturename.jpg");
Yup! Thanks for whoever answered that! Mark Guzdial

do i need to import anything for pictureCollage if i'm using turtles?
Nope. Mark Guzdial

I figured out my question above about the error. It is a problem with the method increaseRed3 in picture.java. there is something wrong with it, soooo i just chose a different method and everything worked very fine. thanks for the response on the write question, you solved all of my problems. good luck everyone!

Removed at KS request
YAY, KRISTA! Mark Guzdial

I couldn't get the write command to work. I'll just ask in class tomorrow i guess, thanks for your help.

Kyle DuPont
What error did you get? Mark Guzdial



so Sebastian will change the mediapath when he runs our class file, right? or should we go ahead and put("c:/cs1316/mediasources/") in our file?

Removed at KS request
Sebastian will change the mediaPath, but you should setMediaPath at the beginning of your main() method. Mark Guzdial

can you tell me again how you compose methods? REMOVEDke for instance how would I implement both p3.posterize() and p3.scale(.5) at the same time?

You don't HAVE to compose methods. How about something like this? Mark Guzdial
  Picture p3 = ...;
  p3.posterize();  // returns void, just changes p3
  Picture p4 = p3.scale(0.5); // p4 is now p3, posterized and scaled.





Link to this Page