Results 1 to 3 of 3
  1. #1
    Greedful is offline Member
    Join Date
    Jul 2007
    Posts
    2
    Rep Power
    0

    Default Updating Graphics

    I was curious about a little problem I was having with updating a Graphics2D in a seperate method from the constructor or main. Pretty much I have a BufferedImage as a private Variable of the class which extends Frame/JFrame, and in the constructor I form it as a new BufferedImage with x and y dimensions.

    Now I call upon a method a seperate method, which forms the Graphics2D component from the BufferedImage, and whenever I attempt to draw onto the Graphics2D I get a null pointer exception. Is there something I'm missing here?

  2. #2
    JavaBean's Avatar
    JavaBean is offline Moderator
    Join Date
    May 2007
    Posts
    1,270
    Rep Power
    9

    Default

    Please paste the code here.

  3. #3
    Greedful is offline Member
    Join Date
    Jul 2007
    Posts
    2
    Rep Power
    0

    Default

    No worries, I figured out what I was doing wrong. Sadly it was a beginner's mistake.

    But I do have another question more towards optimization. What is the fastest way to draw an Image onto a Graphics component?

Similar Threads

  1. Help needed with updating mysql database
    By SilentCodingOne in forum New To Java
    Replies: 1
    Last Post: 12-11-2007, 10:23 PM
  2. Updating Local Content
    By ibanez270dx in forum Java Applets
    Replies: 1
    Last Post: 11-02-2007, 01:55 AM
  3. Problems updating blob columns on Oracle 9
    By ljustiniano in forum JDBC
    Replies: 0
    Last Post: 08-14-2007, 06:17 PM
  4. dynamically updating clock
    By malakaherath in forum New To Java
    Replies: 2
    Last Post: 08-01-2007, 07:57 PM
  5. Updating into 2 tables in the DB
    By yuchuang in forum New To Java
    Replies: 2
    Last Post: 05-12-2007, 06:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •