1   /*
2    * FormBackground.java
3    *
4    * Created on November 13, 2002, 7:05 PM
5    */
6   
7   package NetBeansResources;
8   
9   import javax.swing.JPanel.*;
10  import javax.swing.*;
11  import java.awt.*;
12  import java.awt.image.*;
13  import javax.imageio.*;
14  import java.io.*;
15  
16  /** Gets the intro scene to the simulator */
17  public class GetImage extends JPanel 
18  {
19      /** Stores the image. */    
20      private BufferedImage map;
21      /** Stores the rescale operation. */    
22      private RescaleOp op;
23      
24      /** Creates an image from a picture */    
25      public GetImage() 
26      {
27          try{ map= ImageIO.read(new File("images\\intro.gif"));}
28          catch(Exception e){}
29          
30          op =null;
31      }
32      
33      /** Creates an image from a picture
34       * @param name the file name and path of the picture
35       */    
36      public GetImage(String name){
37          try{ map= ImageIO.read(new File(name));}
38          catch(Exception e){}
39          
40          op =null;
41      }
42      
43      /** Paints the image
44       * @param g java graphics object.
45       */    
46      protected void paintComponent(Graphics g) 
47      {
48          super.paintComponent(g);
49          Graphics2D g2 = (Graphics2D)g;
50          g2.drawImage(map, op, 0,0);
51      }
52  }
53  
54