Results 1 to 8 of 8

Thread: change image

  1. #1
    mysa is offline Member
    Join Date
    Aug 2010
    Posts
    4
    Rep Power
    0

    Default change image

    how can i change the oval to picture... i want put a duck picture.

    public void draw(Graphics g) {
    g.fillOval(m_x, m_y, DIAMETER, DIAMETER);
    }

    please help me.....

  2. #2
    gafa's Avatar
    gafa is offline Senior Member
    Join Date
    Jun 2010
    Posts
    107
    Rep Power
    0

    Default

    g.drawImage() method may help I guess

  3. #3
    mysa is offline Member
    Join Date
    Aug 2010
    Posts
    4
    Rep Power
    0

    Default

    So can i put like this....

    g.drawImage("images/duck.gif");
    put the url for the picture.

    it is correct?

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

  5. #5
    mysa is offline Member
    Join Date
    Aug 2010
    Posts
    4
    Rep Power
    0

    Default

    ok. tq. :)

  6. #6
    gafa's Avatar
    gafa is offline Senior Member
    Join Date
    Jun 2010
    Posts
    107
    Rep Power
    0

    Default

    Quote Originally Posted by mysa View Post
    So can i put like this....

    g.drawImage("images/duck.gif");
    put the url for the picture.

    it is correct?
    I don't think so ;)

    To use the method you need to get Image object first... It is IO lib thing and here as I may think your applet must be signed to do so...

    This may help I guess Graphics2D (Java 2 Platform SE v1.4.2), java.awt.geom.AffineTransform, java.awt.image.ImageObserver)

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

    Default

    Quote Originally Posted by gafa View Post
    I don't think so ;)
    To use the method you need to get Image object first... It is IO lib thing
    Yep.

    and here as I may think your applet must be signed to do so...
    Only if you are trying to have the user extract the image from their own computer. If the image is on the server, then AFAIK, the applet doesn't need to be signed.

  8. #8
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,661
    Blog Entries
    7
    Rep Power
    21

Similar Threads

  1. Change colors, image on WizardDialog
    By laurie in forum SWT / JFace
    Replies: 0
    Last Post: 06-16-2010, 04:30 PM
  2. uploaded image wont display if i change filename
    By schenker in forum Java Servlet
    Replies: 12
    Last Post: 06-11-2010, 11:13 AM
  3. Javascript change image
    By butsags in forum New To Java
    Replies: 1
    Last Post: 12-10-2009, 11:08 PM
  4. how to change windows xp background image through java
    By erosenthil in forum Advanced Java
    Replies: 1
    Last Post: 08-18-2009, 12:57 PM
  5. Replies: 0
    Last Post: 01-08-2008, 05:29 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
  •