Search:

Type: Posts; User: Norm

Page 1 of 2 1 2

Search: Search took 0.16 seconds.

  1. Re: I had an old code it really sucked, so i now am making a new one

    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...
  2. Re: I had an old code it really sucked, so i now am making a new one

    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...
  3. Re: I had an old code it really sucked, so i now am making a new one

    How will it do that? A method can only return ONE thing.
  4. Re: I had an old code it really sucked, so i now am making a new one

    How do you get those values?
  5. Re: I had an old code it really sucked, so i now am making a new one

    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...
  6. Re: I had an old code it really sucked, so i now am making a new one

    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()...
  7. Re: I had an old code it really sucked, so i now am making a new one

    What is this statement supposed to do:
    return Point(int x, int y);

    The syntax is wrong.
  8. Re: I had an old code it really sucked, so i now am making a new one

    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.
  9. Re: I had an old code it really sucked, so i now am making a new one

    What you describe would be for two separate methods.
  10. Re: I had an old code it really sucked, so i now am making a new one

    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...
  11. Re: I had an old code it really sucked, so i now am making a new one

    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...
  12. Re: I had an old code it really sucked, so i now am making a new one

    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...
  13. Re: I had an old code it really sucked, so i now am making a new one

    Also see post#28
  14. Re: I had an old code it really sucked, so i now am making a new one

    How does that code fit into the design for what checkColor is supposed to do?
    I don't see any relationship.
  15. Re: I had an old code it really sucked, so i now am making a new one

    What is the while (!checkColor(inputColor)) for?
    When is it executed?
  16. Re: I had an old code it really sucked, so i now am making a new one

    Is all that the logic for the one method: checkColor? This method you are trying to code:


    public boolean checkColor(Color inputColor) {
    BufferedImage image =...
  17. Re: I had an old code it really sucked, so i now am making a new one

    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...
  18. Re: I had an old code it really sucked, so i now am making a new one

    The idea is to do the design BEFORE you write the code.
  19. Re: I had an old code it really sucked, so i now am making a new one

    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...
  20. Re: I had an old code it really sucked, so i now am making a new one

    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...
  21. Re: I had an old code it really sucked, so i now am making a new one

    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.
  22. Re: I had an old code it really sucked, so i now am making a new one

    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...
  23. Re: I had an old code it really sucked, so i now am making a new one

    Did you add the return statement at the end of the method?
    The {} should be aligned like this. Indented every nesting level


    {
    {
    {

    }
    }
  24. Re: I had an old code it really sucked, so i now am making a new one

    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...
  25. Re: I had an old code it really sucked, so i now am making a new one

    Try some of these:
    Trail: Learning the Java Language: Table of Contents (The Java™ Tutorials)
    The Really Big Index
Results 1 to 25 of 34
Page 1 of 2 1 2