Search:

Type: Posts; User: Norm

Search: Search took 0.11 seconds.

  1. Replies
    48
    Views
    3,233

    Re: Analogue Clock Problem

    Good luck on your next project.
  2. Replies
    48
    Views
    3,233

    Re: Analogue Clock Problem

    No, that is normal.
  3. Replies
    48
    Views
    3,233

    Re: Analogue Clock Problem

    I assume that a lot of the printouts you are seeing are from the paintComponent method or by methods that the paintComponent method calls. The paintComponent method can be called many times. Each...
  4. Replies
    48
    Views
    3,233

    Re: Analogue Clock Problem

    The loading of the images done in the getImg method should be moved to the constructor so that the image is only loaded once.

    This is wrong. Don't add the + "jpg" in the print out:
    ...
  5. Replies
    48
    Views
    3,233

    Re: Analogue Clock Problem

    My code was only meant as an example. You need to write the code that works with your program.

    Did you make the changes I suggested? What prints out for the value of the parameter that is used by...
  6. Replies
    48
    Views
    3,233

    Re: Analogue Clock Problem

    If you are passing the image file filenames to the constructor, next you should check that the constructor is using the filenames correctly to load the files.
    Create a String that will be used in...
  7. Replies
    48
    Views
    3,233

    Re: Analogue Clock Problem

    A suggestion. Simplify your code by passing the image filename to the constructor:
    pPink = new Pointer(3600, "pink.jpg");
  8. Replies
    48
    Views
    3,233

    Re: Analogue Clock Problem

    I'll try to ask very simple questions one at a time to see if you can understand it.
    Do you know what an assignment statement is?
    Please post some assignment statements that assign values to a...
  9. Replies
    48
    Views
    3,233

    Re: Analogue Clock Problem

    I think you are wrong there.
    I think the image filenames are: "pink.jpg" "weird.jpg" and "rose.jpg"
    These are the names of the files on your disk.

    I think your problem is that you are using a...
  10. Replies
    48
    Views
    3,233

    Re: Analogue Clock Problem

    Let's start with a simple question: What are the filenames of the images that you want to view?
    The filenames are represented as Strings in your program.




    Where in your code is there an...
  11. Replies
    48
    Views
    3,233

    Re: Analogue Clock Problem

    If you are not interested enough in making your code work to look at it and see where you assign a value to the filename variables, I don't know what else I can do to help you.

    Where do you assign...
  12. Replies
    48
    Views
    3,233

    Re: Analogue Clock Problem

    You are missing my question.
    Where do you assign values to the image filename variables?
    You assign values to a variable by using an assignment statement like this:

    var = "value"; // assign a...
  13. Replies
    48
    Views
    3,233

    Re: Analogue Clock Problem

    What you posted does NOT give values to the pink, weird and rose variables.
    Where do you give them values?
  14. Replies
    48
    Views
    3,233

    Re: Analogue Clock Problem

    Where do you give a value to the filename arguments that are passed to the Pointer constructor?
    Why are they null?
  15. Replies
    48
    Views
    3,233

    Re: Analogue Clock Problem

    The filename should be a String. The value of a String has NOTHING to do the the contents of a file.

    What are the filenames of the images you want to display? Why isn't that filename being passed...
  16. Replies
    48
    Views
    3,233

    Re: Analogue Clock Problem

    What were you printing out? Look at the print statement again. Was it the filename of the image?
    I thought what you were printing was the filename of the image.
    Why is your image filename null?
    ...
  17. Replies
    48
    Views
    3,233

    Re: Analogue Clock Problem

    Do you understand what that print out is showing?
    Are there any images with that name?
    As a test, copy and rename one of your images and give it the name: null.jpg
  18. Replies
    48
    Views
    3,233

    Re: Analogue Clock Problem

    What is printed out? Copy and paste the print out here.
  19. Replies
    48
    Views
    3,233

    Re: Analogue Clock Problem

    What don't you understand about this request? In your code you call the getResource() method and pass it an argument. Print that out to see what it is.


    ImageIcon ii = new...
  20. Replies
    48
    Views
    3,233

    Re: Analogue Clock Problem

    What I'm trying to help you learn is how to debug your code. If you print out the values of the variables that you are using, you will see what some of the problems are with your code.

    Add some...
  21. Replies
    48
    Views
    3,233

    Re: Analogue Clock Problem

    Add some printlns to print the values the images loaded in Pointer after they have been loaded.
    What is printed out???

    Also print out the full filename of the image before it is loaded
  22. Replies
    48
    Views
    3,233

    Re: Analogue Clock Problem

    The constructor's args are messed up. He's mixing apples and oranges to build an image filename.
  23. Replies
    48
    Views
    3,233

    Re: Analogue Clock Problem

    Move this code to the constructor:


    ImageIcon ii = new ImageIcon(this.getClass().getResource(img+".jpg"));
    img = ii.getImage();
  24. Replies
    48
    Views
    3,233

    Re: Analogue Clock Problem

    Did you do this:
    Are all the images found and loaded?
    Add some printlns to show their values after they have been loaded.
    What values were printed out for the images?


    If the message did not...
  25. Replies
    48
    Views
    3,233

    Re: Analogue Clock Problem

    Can you describe what you see when you execute the code?
    Are all the images found and loaded? Add some printlns to show their values after they have been loaded.

    Your code would be more...
Results 1 to 25 of 25