Search:

Type: Posts; User: Norm

Search: Search took 0.12 seconds.

  1. Replies
    29
    Views
    3,488

    [SOLVED] Re: What's causing this Null Pointer Exception?

    yes that could be it
  2. Replies
    29
    Views
    3,488

    [SOLVED] Re: What's causing this Null Pointer Exception?

    There is/are method(s) that will give you the width of a character when it is drawn using a font.
    I don't remember what class it is in. You'll have to do some research.
    Get each character, get its...
  3. Replies
    29
    Views
    3,488

    [SOLVED] Re: What's causing this Null Pointer Exception?

    Where are you drawing these letters? Look at arguments 4 and 5
  4. Replies
    29
    Views
    3,488

    [SOLVED] Re: What's causing this Null Pointer Exception?

    g.drawChars(chars, i, i+1,300,300);
    Have you read the API doc for this method? What are the second and third args?
  5. Replies
    29
    Views
    3,488

    [SOLVED] Re: What's causing this Null Pointer Exception?

    What statement is causing the error?
  6. Replies
    29
    Views
    3,488

    [SOLVED] Re: What's causing this Null Pointer Exception?

    As you suggested in your last post, check the scope of the variable. Define the variable at the class level and make sure there isn't another variable with the same name at an inner scope.
  7. Replies
    29
    Views
    3,488

    [SOLVED] Re: What's causing this Null Pointer Exception?

    Good idea to check the scope of your variables. Make sure you don't have definitions of variables with the same names at different levels of scope.


    Use println statement before the if statement...
  8. Replies
    29
    Views
    3,488

    [SOLVED] Re: What's causing this Null Pointer Exception?

    Use variables in the new Color constructor that do not have 0 values.
    new Color(rd, grn, bl); // be sure rd, grn and bl are not all 0


    No idea what you are talking about.
    Constructor?...
  9. Replies
    29
    Views
    3,488

    [SOLVED] Re: What's causing this Null Pointer Exception?

    Add a println after that statement to verify what is in the chars array:
    System.out.println("chars=" + java.util.Arrays.toString(chars));
    Then you'll know
  10. Replies
    29
    Views
    3,488

    [SOLVED] Re: What's causing this Null Pointer Exception?

    Can you show me the code that puts values in the array?
  11. Replies
    29
    Views
    3,488

    [SOLVED] Re: What's causing this Null Pointer Exception?

    Then it is not being initialized.
    Add printlns after the statement that initializes it
    and before the statement that uses it.
    See what order they print out in.
  12. Replies
    29
    Views
    3,488

    [SOLVED] Re: What's causing this Null Pointer Exception?

    Its a question of where/when the code in your program is being executed. If the code that uses a variable before it is initialized is executed BEFORE the code that initializes the variable, then you...
  13. Replies
    29
    Views
    3,488

    [SOLVED] Re: What's causing this Null Pointer Exception?

    Yes, that is exactly how you can get a NullPointerException.
    You must initialize a variable BEFORE you use it.
  14. Replies
    29
    Views
    3,488

    [SOLVED] Re: What's causing this Null Pointer Exception?

    I'm sure you have heard this before. Seeing that you have 1219 posts.

    Please post it.
Results 1 to 14 of 14