tint out a picture to a flag but got errors: cannot resolve to variable
I have this as an assignment to tint out a picture into kinda like a Dutch flag. But i have a lot of troubles figuring out the way to divide the height into sections. When I did it like below I got lots of errors that mostly says "cannot resolve to a variable".
Here's my code:
/* Assignment 3, Part 2 - Go Dutch! */
public class Assignment3Part2
{
//
public static void main(String args) throws InterruptedException
{
String filename;
if (args.length > 0) {
// got a filename passed into program as a parameter
// don't change this part of the code needed by TA for grading
filename = args[0];
System.out.println("Filename passed in: " + filename);
} else {
// ask user for a picture
filename = FileChooser.pickAFile();
System.out.println("User picked file: " + filename);
}
Picture pic = new Picture(filename); // Picture to modify
//
pic.show(); // Show the original picture
Thread.sleep(1000); // Pause for 1 second. You can pause for less if you like
Pixel pixelArray = pic.getPixels();
// TODO:
for(int x = 0; x < pic.getWidth(); x++);
{
for (int y = 0; y < pic.getHeight(); y++);
{
int h = pic.getHeight();
if ( y <=(h/3))
{
value = pic.getOrange();
value = (int)(value*1.5);
pic.setOrange(value);
}
if ( y > (h/3)&& y < (2*h/3))
{
value = pic.getWhite();
value = (int)(value*1.5);
pic.setWhite(value);
}
else {
value = pic.getGreen();
value = (int)(value*1.5);
pic.setGreen(value);
}
}
}
}
pic.repaint();
} // End of main
} // End of Class
And here's the errors the system gives:
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 34]
Error: y cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 37]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 37]
Error: The method getOrange() is undefined for the type Picture
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 38]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 38]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 39]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 41]
Error: y cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 41]
Error: y cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 44]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 44]
Error: The method getWhite() is undefined for the type Picture
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 45]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 45]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 46]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 50]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 50]
Error: The method getGreen() is undefined for the type Picture
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 51]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 51]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 52]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 60]
Error: Syntax error on token "repaint", Identifier expected after this token
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 62]
Error: Syntax error on token "}", delete this token
Can someone explain and also help me solve this problem? thanks
java variables pixel tint
add a comment |
I have this as an assignment to tint out a picture into kinda like a Dutch flag. But i have a lot of troubles figuring out the way to divide the height into sections. When I did it like below I got lots of errors that mostly says "cannot resolve to a variable".
Here's my code:
/* Assignment 3, Part 2 - Go Dutch! */
public class Assignment3Part2
{
//
public static void main(String args) throws InterruptedException
{
String filename;
if (args.length > 0) {
// got a filename passed into program as a parameter
// don't change this part of the code needed by TA for grading
filename = args[0];
System.out.println("Filename passed in: " + filename);
} else {
// ask user for a picture
filename = FileChooser.pickAFile();
System.out.println("User picked file: " + filename);
}
Picture pic = new Picture(filename); // Picture to modify
//
pic.show(); // Show the original picture
Thread.sleep(1000); // Pause for 1 second. You can pause for less if you like
Pixel pixelArray = pic.getPixels();
// TODO:
for(int x = 0; x < pic.getWidth(); x++);
{
for (int y = 0; y < pic.getHeight(); y++);
{
int h = pic.getHeight();
if ( y <=(h/3))
{
value = pic.getOrange();
value = (int)(value*1.5);
pic.setOrange(value);
}
if ( y > (h/3)&& y < (2*h/3))
{
value = pic.getWhite();
value = (int)(value*1.5);
pic.setWhite(value);
}
else {
value = pic.getGreen();
value = (int)(value*1.5);
pic.setGreen(value);
}
}
}
}
pic.repaint();
} // End of main
} // End of Class
And here's the errors the system gives:
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 34]
Error: y cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 37]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 37]
Error: The method getOrange() is undefined for the type Picture
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 38]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 38]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 39]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 41]
Error: y cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 41]
Error: y cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 44]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 44]
Error: The method getWhite() is undefined for the type Picture
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 45]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 45]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 46]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 50]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 50]
Error: The method getGreen() is undefined for the type Picture
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 51]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 51]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 52]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 60]
Error: Syntax error on token "repaint", Identifier expected after this token
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 62]
Error: Syntax error on token "}", delete this token
Can someone explain and also help me solve this problem? thanks
java variables pixel tint
add a comment |
I have this as an assignment to tint out a picture into kinda like a Dutch flag. But i have a lot of troubles figuring out the way to divide the height into sections. When I did it like below I got lots of errors that mostly says "cannot resolve to a variable".
Here's my code:
/* Assignment 3, Part 2 - Go Dutch! */
public class Assignment3Part2
{
//
public static void main(String args) throws InterruptedException
{
String filename;
if (args.length > 0) {
// got a filename passed into program as a parameter
// don't change this part of the code needed by TA for grading
filename = args[0];
System.out.println("Filename passed in: " + filename);
} else {
// ask user for a picture
filename = FileChooser.pickAFile();
System.out.println("User picked file: " + filename);
}
Picture pic = new Picture(filename); // Picture to modify
//
pic.show(); // Show the original picture
Thread.sleep(1000); // Pause for 1 second. You can pause for less if you like
Pixel pixelArray = pic.getPixels();
// TODO:
for(int x = 0; x < pic.getWidth(); x++);
{
for (int y = 0; y < pic.getHeight(); y++);
{
int h = pic.getHeight();
if ( y <=(h/3))
{
value = pic.getOrange();
value = (int)(value*1.5);
pic.setOrange(value);
}
if ( y > (h/3)&& y < (2*h/3))
{
value = pic.getWhite();
value = (int)(value*1.5);
pic.setWhite(value);
}
else {
value = pic.getGreen();
value = (int)(value*1.5);
pic.setGreen(value);
}
}
}
}
pic.repaint();
} // End of main
} // End of Class
And here's the errors the system gives:
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 34]
Error: y cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 37]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 37]
Error: The method getOrange() is undefined for the type Picture
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 38]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 38]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 39]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 41]
Error: y cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 41]
Error: y cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 44]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 44]
Error: The method getWhite() is undefined for the type Picture
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 45]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 45]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 46]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 50]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 50]
Error: The method getGreen() is undefined for the type Picture
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 51]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 51]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 52]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 60]
Error: Syntax error on token "repaint", Identifier expected after this token
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 62]
Error: Syntax error on token "}", delete this token
Can someone explain and also help me solve this problem? thanks
java variables pixel tint
I have this as an assignment to tint out a picture into kinda like a Dutch flag. But i have a lot of troubles figuring out the way to divide the height into sections. When I did it like below I got lots of errors that mostly says "cannot resolve to a variable".
Here's my code:
/* Assignment 3, Part 2 - Go Dutch! */
public class Assignment3Part2
{
//
public static void main(String args) throws InterruptedException
{
String filename;
if (args.length > 0) {
// got a filename passed into program as a parameter
// don't change this part of the code needed by TA for grading
filename = args[0];
System.out.println("Filename passed in: " + filename);
} else {
// ask user for a picture
filename = FileChooser.pickAFile();
System.out.println("User picked file: " + filename);
}
Picture pic = new Picture(filename); // Picture to modify
//
pic.show(); // Show the original picture
Thread.sleep(1000); // Pause for 1 second. You can pause for less if you like
Pixel pixelArray = pic.getPixels();
// TODO:
for(int x = 0; x < pic.getWidth(); x++);
{
for (int y = 0; y < pic.getHeight(); y++);
{
int h = pic.getHeight();
if ( y <=(h/3))
{
value = pic.getOrange();
value = (int)(value*1.5);
pic.setOrange(value);
}
if ( y > (h/3)&& y < (2*h/3))
{
value = pic.getWhite();
value = (int)(value*1.5);
pic.setWhite(value);
}
else {
value = pic.getGreen();
value = (int)(value*1.5);
pic.setGreen(value);
}
}
}
}
pic.repaint();
} // End of main
} // End of Class
And here's the errors the system gives:
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 34]
Error: y cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 37]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 37]
Error: The method getOrange() is undefined for the type Picture
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 38]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 38]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 39]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 41]
Error: y cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 41]
Error: y cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 44]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 44]
Error: The method getWhite() is undefined for the type Picture
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 45]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 45]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 46]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 50]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 50]
Error: The method getGreen() is undefined for the type Picture
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 51]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 51]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 52]
Error: value cannot be resolved to a variable
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 60]
Error: Syntax error on token "repaint", Identifier expected after this token
File: C:UsersnhockDesktopSchool WorkUNCC Fall 20181212ITIS_1212bookClassesAssignment3Part2.java [line: 62]
Error: Syntax error on token "}", delete this token
Can someone explain and also help me solve this problem? thanks
java variables pixel tint
java variables pixel tint
asked Nov 15 '18 at 0:34
Dave PhanDave Phan
92
92
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Remove semicolon directly after for loop conditions. In Java ‘;’ tells that instruction ends. As a result code after semicolon doesn’t belong to for loop.
for(int x = 0; x < pic.getWidth(); x++) {
for (int y = 0; y < pic.getHeight(); y++) {
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53310821%2ftint-out-a-picture-to-a-flag-but-got-errors-cannot-resolve-to-variable%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Remove semicolon directly after for loop conditions. In Java ‘;’ tells that instruction ends. As a result code after semicolon doesn’t belong to for loop.
for(int x = 0; x < pic.getWidth(); x++) {
for (int y = 0; y < pic.getHeight(); y++) {
add a comment |
Remove semicolon directly after for loop conditions. In Java ‘;’ tells that instruction ends. As a result code after semicolon doesn’t belong to for loop.
for(int x = 0; x < pic.getWidth(); x++) {
for (int y = 0; y < pic.getHeight(); y++) {
add a comment |
Remove semicolon directly after for loop conditions. In Java ‘;’ tells that instruction ends. As a result code after semicolon doesn’t belong to for loop.
for(int x = 0; x < pic.getWidth(); x++) {
for (int y = 0; y < pic.getHeight(); y++) {
Remove semicolon directly after for loop conditions. In Java ‘;’ tells that instruction ends. As a result code after semicolon doesn’t belong to for loop.
for(int x = 0; x < pic.getWidth(); x++) {
for (int y = 0; y < pic.getHeight(); y++) {
answered Nov 15 '18 at 2:38
uliuli
519313
519313
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53310821%2ftint-out-a-picture-to-a-flag-but-got-errors-cannot-resolve-to-variable%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown