Results 1 to 11 of 11

Thread: jpg not showing in canvas

Threaded View

  1. #1

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Resolved jpg not showing in canvas

    I have a class that adds the following class to a container. Then shows the JFrame that contains the container. ie container.add(new MovieImage()); When the JFrame is made visible the image does not show. The image only appears when the JFrame is either resized or iconified then deiconified. Any suggestions as to how i could go about getting the image to appear the first time the JFrame is drawn? Thanks.
    Code:
    class DrinkImage extends Canvas{
      public DrinkImage(){
        setSize(25,50); 
      }
      public void paint(Graphics g){
       Toolkit tk = Toolkit.getDefaultToolkit();
       Image image = tk.getImage("C:\\Beer.jpg");
       g.drawImage(image,10,10,null);
      }
     }

Posting Permissions

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



Click Here to Expand Forum to Full Width