- Java and JSP
||11-02-2012 08:05 PM
Calling this method
Super noobie question but I don't have a clue..
public void changeWhole(double amount)
Pixel pixelArray = this.getPixels();
Pixel pixel = null;
int value = 0;
int i = 0;
while( i < pixelArray.length)
pixel = pixelArray[i];
value = pixel.getBlue();
pixel.setBlue((int) (value * amount));
public static void main(String args)
String fileName = FileChooser.pickAFile();
Picture pictObj = new Picture(fileName);
I dont know how to call the changeWhole method in the main method without getting any errors.
||11-02-2012 09:59 PM
Is the class this method resides in "Picture"? If so, you can just use in the main:
pictObj.changeWhole(50.0); for example. That should be the correct way to call it.
That doesn't mean you won't get other errors, but the method itself appears to be written to prevent errors as much as possible. The only one that should be possible to throw an error is pixelArray.length, which will only occur if this.getPixels() returns void or null.
That assumes you are not referring to a compilation error though.
|All times are GMT +1. The time now is 11:58 AM.
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.