Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jan 2003
    Location
    USA
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Java coding problem

    Is there any way to set the background of an applet to an image file like a .bmp image?

  • #2
    New Coder
    Join Date
    Jun 2002
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts
    .bmp bitmaps should not be used in Java. JPEG and GIF are the standards. You could simply draw the image in the paint method of your applet or another component.

    public void paint(Graphics g)
    {
    super.paint(g);
    Image im = getImage(getDocumentBase(), "myfile.gif");
    g.drawImage(im, 0, 0, getSize().width, getSize().height, this);
    }
    Last edited by Josh Campbell; 02-03-2003 at 11:03 PM.

  • #3
    New Coder
    Join Date
    Jan 2003
    Location
    USA
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks


  •  

    Posting Permissions

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