Help Drawing An Image

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • deathbow2134
    New Member
    • Aug 2007
    • 3

    #1

    Help Drawing An Image

    I know I sound like a compelete novice when I say this, but I just cant draw Images in java appliactions. I copied the code right from Sun's website and added an image to the codes base, and yes, the file names where the same. It failed to load. When I tried to use a just a URL, it didn't work either. I am not a Java novice, I understand the Swing API, and the Abstract Window Toolkit, but I cant seem to load images. I will run the applet/appletication but the image does not appear.

    To see if the image was not laoding i tried

    if (Image_name_her e == null){
    g.setColor(Colo r.yellow);
    g.drawString("E rror");
    }
    it didn't draw the Error message, someone guide me thought the basics.

    Thanks
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Are you trying to invoke one of the Graphics.drawIm age() methods or do you stick
    the image (e.g. an Icon) in a JLabel and let the JLabel do the dirty work?

    kind regards,

    Jos

    Comment

    Working...