Please post something that looks more like code, I can not tell what you are talking about.
For example this looks like a compare not an assignment statement:
== tests for equality
This makes...
Type: Posts; User: Norm
Please post something that looks more like code, I can not tell what you are talking about.
For example this looks like a compare not an assignment statement:
== tests for equality
This makes...
You do not call classes. You call methods. Methods are part of a class.
Your code is full of calls to methods:
if (image.getRGB(x, y) == inputColor.getRGB()) // 2 calls tp getRGB()
BufferedImage...
How will it do that? A method can only return ONE thing.
How do you get those values?
If you want to create an instance of a class you need to use the new statement.
Your call to the Point class constructor does not have any parameters.
How are you going to return the x and y...
What is the code supposed to do? What is the int value that checkColor() is supposed to return?
Setting a value is very different from getting a value.
Where is the method: getLocation()...
What is this statement supposed to do:
return Point(int x, int y);
The syntax is wrong.
Methods can have many parameters passed to them.
The RGB data is contained in an int.
Use a Point class object to return the x & y values.
What you describe would be for two separate methods.
A method will only execute one return statement. When it is executed, execution flow exits the method and returns the one value. The extra returns in the get method will not execute.
You need to...
Do you know how to define a class with members?
Look at using the constructor to take the three values and to store them in the class's member variables.
See the tutorials if you don't know what...
Are you changing the design of what the method is supposed to do now?
A method can only return one value. To return more than one value it would have to put all of them into a class as member...
Also see post#28
How does that code fit into the design for what checkColor is supposed to do?
I don't see any relationship.
What is the while (!checkColor(inputColor)) for?
When is it executed?
Is all that the logic for the one method: checkColor? This method you are trying to code:
public boolean checkColor(Color inputColor) {
BufferedImage image =...
Now write detailed specifications for what the method that will check for the desired color: 4)
What are the steps that it needs to do?
Make a list of simple steps or pseudo code that describes...
The idea is to do the design BEFORE you write the code.
Can you describe in detail what the checkColor method is supposed to do?
What arguments are passed to it,
what processing it does
What results it returns and what values it changes
Then take...
In your other thread for this problem:
http://www.javaprogrammingforums.com/whats-wrong-my-code/13736-nothing-really-wrong-but-i-cant-seem-get-past-stone-wall.html
I said:
This code you have...
Yes you could define the y outside of the for loop.
What value do you want y to have outside of the loop? It would always have the last value it had when it exited the loop.
The variable y is only known within the for loop where it is defined. It is not known outside of the loop.
Look at the logic of your code. In the for(y) loop, it can sometimes return true or it...
Did you add the return statement at the end of the method?
The {} should be aligned like this. Indented every nesting level
{
{
{
}
}
Where is line 30. What code is there?
You need to add a return statement at the end of the checkColor() method.
You may have an infinite loop if you call the checkColor method from inside of the...
Try some of these:
Trail: Learning the Java Language: Table of Contents (The Java™ Tutorials)
The Really Big Index