×

Discussion Board

Results 1 to 2 of 2

Thread: Canvas

  1. #1
    Regular Contributor
    Join Date
    Apr 2004
    Posts
    89

    Canvas

    Hi
    How i can set the background image in canvas

    Please provide me some sample code for that.

    Thanx

    Jignesh

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280
    Code:
    public class MyCanvas extends Canvas {
      Image background;
      public void paint(Graphics g) {
        if (background != null) {
          g.drawImage(background,0,0,Graphics.TOP|Graphics.LEFT);
        }
        // the rest of the paint code
      }
    }
    shmoove

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×