Results 1 to 1 of 1
  1. #1
    sakratt is offline Member
    Join Date
    Mar 2012
    Posts
    2
    Rep Power
    0

    Default Graphics.drawImage() question

    Say that I override the paint method in a class that extends JPanel, like this:
    Java Code:
    public void paint(Graphics g) {
           super.paint(g);
           g.drawImage(anImage, 0, 0, null);
    }
    Will the drawImage method draw the entire image even if it is outside of the frame bounds? Or does it automatically draw the parts of the image that actually are inside the frame? When creating GUI applications I usually create a JFrame with a JPanel of the same size in it. I'm asking because I'm working on something that draws a huge image which moves around and I would like to know if it efficient or not.

    If this is unclear, I'm sorry, but please to try answer the question if you think you know the answer. I'm not really sure how to ask.
    Last edited by sakratt; 03-29-2012 at 08:56 AM.

Similar Threads

  1. NullPointerException on Graphics.drawImage
    By Jaeela in forum New To Java
    Replies: 5
    Last Post: 10-05-2011, 02:36 AM
  2. Graphics question
    By Guy in forum New To Java
    Replies: 6
    Last Post: 07-19-2011, 07:23 AM
  3. Question on Graphics/JFrame/KeyEvents
    By loopsnhoops in forum New To Java
    Replies: 4
    Last Post: 02-10-2011, 11:22 PM
  4. Question on Graphics etc...
    By loopsnhoops in forum Advanced Java
    Replies: 2
    Last Post: 02-10-2011, 11:10 PM
  5. java graphics question
    By bobCallahan24 in forum AWT / Swing
    Replies: 1
    Last Post: 01-15-2010, 06:04 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
  •