Results 1 to 5 of 5

Thread: Image Drawing

  1. #1
    dvreed77 is offline Member
    Join Date
    Feb 2011
    Posts
    27
    Rep Power
    0

    Default Image Drawing

    Hello,

    I am trying to follow a tutorial given by Oracle found here and having some difficulties.

    I copied the entire code, found here, and it worked fine with the given image.

    The problem is if I give it a new larger image it only shows the top left corner that was the same size as the given image. The getHeight and getWidth methods are returning the correct values and the drawImage method is being the right values as well.

    I can seem to figure out why its doing this. BTW the window appears at the correct size but only the top corner is being drawn.

    Any help would be very appreciated.

  2. #2
    dvreed77 is offline Member
    Join Date
    Feb 2011
    Posts
    27
    Rep Power
    0

    Default

    Just figured it out! Im using Eclipse and under properties it was given inputs of 200 x 200.

    I just need to figure out how to make this dynamic based on the image.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Since you're doing this in an applet, I believe that the size of the applet is determined in the HTML code -- though I may be wrong as I'm no applet expert!

  4. #4
    dvreed77 is offline Member
    Join Date
    Feb 2011
    Posts
    27
    Rep Power
    0

    Default

    I'm very new to this, but I'm not running this through html at all.

    I don't even know if I know the difference between an applet and an application.

    I'm inferring that an applet is on a web page and the other is not.

  5. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by dvreed77 View Post
    I'm very new to this, but I'm not running this through html at all.

    I don't even know if I know the difference between an applet and an application.

    I'm inferring that an applet is on a web page and the other is not.
    Correct. If you are running your applet in Eclipse, then you're using it's applet viewer. If you want to create a Swing stand-alone program, then create a JFrame.

Similar Threads

  1. Image data pre drawing
    By trishtren in forum Java 2D
    Replies: 1
    Last Post: 02-10-2011, 09:17 PM
  2. Replies: 1
    Last Post: 04-17-2009, 01:44 AM
  3. Drawing a shape on an image
    By Yoruichi in forum Java 2D
    Replies: 2
    Last Post: 03-29-2009, 03:49 PM
  4. Drawing on an image
    By kratra in forum New To Java
    Replies: 0
    Last Post: 02-06-2009, 09:58 PM
  5. drawing an image to an offscreen image
    By hunterbdb in forum Java 2D
    Replies: 9
    Last Post: 10-30-2008, 07:17 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
  •