An Image in an Applet
Previous    Next    Home    Source    Package

Notes
  1. The applet displays an image taken from a file named board.jpg on gauss.ececs.uc.edu. This is effortless in Java due to the URL class. So, to bring in the image we use something like
      Image board;
      String board_jpg = 
         "http://gauss.ececs.uc.edu/Courses/c694/extra/ImageTest/board.jpg";
      try {
         board = (Toolkit.getDefaultToolkit()).getImage(new URL(board_jpg));
      } catch (MalformedURLException e) { }
    
    and to use it we can write
       bggraphics.drawImage(board,0,0,this);
       g.drawImage(bgimage, 0, 0, this);