Results 1 to 4 of 4
  1. #1
    augustas656 is offline Senior Member
    Join Date
    Apr 2014
    Location
    United Kingdom
    Posts
    115
    Rep Power
    0

    Question How do I add an image on to a Graphics object / JFrame.

    I use Canvas, Graphics & JFrame, but not JPanel, how do I add an Image? To see my code: [Java] package pack.script.game; import java.awt.BorderLayout; import java.awt.Canv - Pastebin.com
    What do I need to add, or where can I find information on how to add an image? Can I add an image using Graphics? I will import any utils, swings or awts needed. But I don't want to change my code too much.

    Thanks
    Augustas

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,387
    Rep Power
    25

    Default Re: How do I add an image on to a Graphics object / JFrame.

    Can I add an image using Graphics?
    One way: Override the paintComponent() method and use the drawImage() method
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    augustas656 is offline Senior Member
    Join Date
    Apr 2014
    Location
    United Kingdom
    Posts
    115
    Rep Power
    0

    Default Re: How do I add an image on to a Graphics object / JFrame.

    Quote Originally Posted by Norm View Post
    One way: Override the paintComponent() method and use the drawImage() method
    Explain please. Did you look at my code?

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,387
    Rep Power
    25

    Default Re: How do I add an image on to a Graphics object / JFrame.

    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. Graphics smearing in JFrame
    By ImTroyMiller in forum AWT / Swing
    Replies: 9
    Last Post: 01-15-2014, 09:04 AM
  2. Displaying graphics on JFrame
    By ManyProblems in forum New To Java
    Replies: 5
    Last Post: 07-31-2012, 06:12 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. Need Help with graphics / Jframe
    By loopsnhoops in forum AWT / Swing
    Replies: 1
    Last Post: 02-10-2011, 11:15 PM
  5. Graphics with JFrame
    By kandt in forum New To Java
    Replies: 3
    Last Post: 12-02-2008, 12:51 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
  •