equal
deleted
inserted
replaced
|
1 package org.homelinux.largo.utils; |
|
2 |
|
3 import java.awt.Canvas; |
|
4 import java.awt.Dimension; |
|
5 import java.awt.Image; |
|
6 import java.net.URL; |
|
7 |
|
8 import javax.swing.ImageIcon; |
|
9 |
|
10 public class ImgComponent extends Canvas { |
|
11 static final long serialVersionUID = 140208; |
|
12 private Image img = null; |
|
13 |
|
14 public ImgComponent (String sFile) { |
|
15 ClassLoader cl = getClass ().getClassLoader (); |
|
16 URL url = cl.getResource (sFile); |
|
17 img = new ImageIcon (url).getImage (); |
|
18 } |
|
19 |
|
20 public Image getImage () { |
|
21 return img; |
|
22 } |
|
23 |
|
24 public Dimension getPreferredSize () { |
|
25 return new Dimension (img.getWidth (this), img.getHeight (this)); |
|
26 } |
|
27 |
|
28 public Dimension getMinimumSize () { |
|
29 return getPreferredSize (); |
|
30 } |
|
31 } |