Results 1 to 4 of 4
  1. #1
    owboateng is offline Member
    Join Date
    Feb 2011
    Posts
    4
    Rep Power
    0

    Default drawing images in swing

    Hi everyone,
    I need to draw an image on another imagein a JPanel:
    public void paint(graphics g){
    super.paint(g);
    Graphics2D g2d = (Graphics2D)g;
    g2d.drawImage(board, 110, 130, this);
    g2d.drawImage(pebble,122,140,this);
    }
    where pebble is an image to be drawn on image board.
    My problem is the background of pebble appears on the image board when drawn on it.How would I make the background of pebble image disappear?
    The images are all .png types.
    Thanks

  2. #2
    dlorde is offline Senior Member
    Join Date
    Jun 2008
    Posts
    339
    Rep Power
    7

    Default

    Quote Originally Posted by owboateng View Post
    How would I make the background of pebble image disappear?
    Don't draw it.

  3. #3
    owboateng is offline Member
    Join Date
    Feb 2011
    Posts
    4
    Rep Power
    0

    Default

    forgive my bad grammar...i want to make the background transparent so that it does not appear.thanks

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,453
    Rep Power
    20

Similar Threads

  1. Drawing a selection box using swing
    By edi233 in forum AWT / Swing
    Replies: 6
    Last Post: 05-09-2011, 04:16 PM
  2. Help drawing images for pong game
    By aalsaqri in forum New To Java
    Replies: 4
    Last Post: 05-28-2010, 03:10 PM
  3. Using Images in Swing
    By Chasingxsuns in forum New To Java
    Replies: 5
    Last Post: 08-01-2009, 01:22 AM
  4. drawing images
    By diggitydoggz in forum New To Java
    Replies: 4
    Last Post: 01-02-2009, 04:15 AM
  5. Default Swing Images
    By Bubba_OH in forum New To Java
    Replies: 5
    Last Post: 10-10-2008, 04:00 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
  •