KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > zirc > gui > ImagePanel


1 package zirc.gui ;
2
3 import java.awt.* ;
4 import java.awt.image.* ;
5 import javax.swing.* ;
6
7 /**
8  * <p>Title: MSGmode</p>
9  * <p>Description: traite le message MODE</p>
10  * <p>Copyright: Copyright (c) 2004</p>
11  * <p>Company: CoolBytes(Stephane Claret, Andre Aymon, Alban Zumofen) coolbytes@hotmail.com</p>
12  * @version 1.0
13  */

14
15
16 public class ImagePanel extends JPanel
17 {
18   private Image img ;
19   ImageObserver imgObserver ;
20   private GridLayout gridLayout1 = new GridLayout() ;
21
22   public ImagePanel(Image _img)
23   {
24     setMinimumSize(new Dimension(300, 100)) ;
25     setPreferredSize(new Dimension(300, 100)) ;
26     img = _img ;
27   }
28
29   public void paint(Graphics g)
30   {
31     g.drawImage(img, 0, 0, this) ;
32   }
33
34   public ImagePanel()
35   {
36     try
37     {
38       jbInit() ;
39     }
40     catch (Exception JavaDoc e)
41     {
42       e.printStackTrace() ;
43     }
44   }
45
46   private void jbInit() throws Exception JavaDoc
47   {
48     this.setBorder(BorderFactory.createLineBorder(Color.gray)) ;
49     this.setLayout(gridLayout1) ;
50   }
51
52 }
53
Popular Tags