Results 1 to 2 of 2
  1. #1
    Aleksas is offline Member
    Join Date
    May 2010
    Posts
    1
    Rep Power
    0

    Default getGraphics() method problem

    Hi,I have a problem with a class that extends Canvas.When I call getGraphics() method for it null is returnin value.
    I read that this method returns null if the component is not currently displayable,so my question is what should I do to make it displayable?
    I tried with setVisible(true) but nothing happens,getGraphics() still returns null.
    Pls help...

  2. #2
    curmudgeon is offline Senior Member
    Join Date
    May 2010
    Posts
    436
    Rep Power
    5

    Default

    The answer usually is: you don't want to do this. I can think of very few reasons for calling this method on Canvas. In short: I'll bet we can show you a better way.

Similar Threads

  1. Problem with int method ..!!
    By ŖΫ ỏ Ңόρę in forum New To Java
    Replies: 19
    Last Post: 01-17-2010, 10:35 PM
  2. recursive method problem
    By melody in forum New To Java
    Replies: 1
    Last Post: 10-29-2009, 08:15 AM
  3. JApplet.getGraphics() draws but JFrame doesn't
    By ChazZeromus in forum New To Java
    Replies: 5
    Last Post: 07-27-2009, 11:02 PM
  4. Method problem
    By Jeff6461 in forum New To Java
    Replies: 1
    Last Post: 03-02-2009, 07:48 AM
  5. Replies: 29
    Last Post: 09-25-2008, 08:55 PM

Posting Permissions

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