Search:

Type: Posts; User: Norm

Search: Search took 0.23 seconds.

  1. Thread: drawString

    by Norm
    Replies
    17
    Views
    2,588

    Re: drawString

    Try to make a small simple program that compiles and executes to display the problem.
    Don't bother to post more of this large, multi part code.
    It needs to demonstrate only what the problem is....
  2. Thread: drawString

    by Norm
    Replies
    17
    Views
    2,588

    Re: drawString

    This is bad!!! The variable name is the same as the type name. Variables should start with lowercase.

    The code is missing many variable definitions. I get 26 compile errors:

    Running:...
  3. Thread: drawString

    by Norm
    Replies
    17
    Views
    2,588

    Re: drawString

    At this point, you need to post code that compiles and executes and demonstrates the problem.
    I can't make sense out of all the bits and pieces you've been posting. I need to see a complete program...
  4. Thread: drawString

    by Norm
    Replies
    17
    Views
    2,588

    Re: drawString

    Graphics2D cannot be resolved

    Do you have the correct import statement?
  5. Thread: drawString

    by Norm
    Replies
    17
    Views
    2,588

    Re: drawString

    To get a graphics object, use the one passed to the paintComponent() method. Call the math() method from paintComponent() and use the Graphics object it receives as math()'s argument.
  6. Thread: drawString

    by Norm
    Replies
    17
    Views
    2,588

    Re: drawString

    yes it would if the variable twostep is null. Or if the math() method expects to receive a value other than null.
  7. Thread: drawString

    by Norm
    Replies
    17
    Views
    2,588

    Re: drawString

    Defining a variable does not give it a value (except for primitives).
    What variable is null?
    Where does your code assign a value to the variable.


    drawString is a method of the Graphics...
  8. Thread: drawString

    by Norm
    Replies
    17
    Views
    2,588

    Re: drawString

    Now you need to learn to read the stack trace.
    Look at these lines starting at the bottom:


    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at...
  9. Thread: drawString

    by Norm
    Replies
    17
    Views
    2,588

    Re: drawString

    When you get errors, it helps us solve the problem if you post all of the text of the error message here.
Results 1 to 9 of 9