author | Markus Bröker <mbroeker@largo.homelinux.org> |
Fri, 17 Dec 2010 22:33:17 +0100 | |
changeset 14 | f12f77aa13b2 |
parent 13 | f83884cc7d2f |
child 16 | 55b0d5006e7b |
permissions | -rw-r--r-- |
0
e0dbaef72362
svn copy of the chess engine
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
1 |
package org.homelinux.largo.utils; |
e0dbaef72362
svn copy of the chess engine
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
2 |
|
e0dbaef72362
svn copy of the chess engine
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
3 |
import java.awt.Canvas; |
e0dbaef72362
svn copy of the chess engine
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
4 |
import java.awt.Dimension; |
e0dbaef72362
svn copy of the chess engine
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
5 |
import java.awt.Image; |
e0dbaef72362
svn copy of the chess engine
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
6 |
import java.net.URL; |
e0dbaef72362
svn copy of the chess engine
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
7 |
|
e0dbaef72362
svn copy of the chess engine
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
8 |
import javax.swing.ImageIcon; |
e0dbaef72362
svn copy of the chess engine
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
9 |
|
e0dbaef72362
svn copy of the chess engine
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
10 |
public class ImgComponent extends Canvas { |
14
f12f77aa13b2
serialVersionUID starts with 1L...
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
13
diff
changeset
|
11 |
static final long serialVersionUID = 1L; |
13
f83884cc7d2f
Source Code re-formatted
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
7
diff
changeset
|
12 |
private Image img; |
0
e0dbaef72362
svn copy of the chess engine
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
13 |
|
13
f83884cc7d2f
Source Code re-formatted
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
7
diff
changeset
|
14 |
public ImgComponent(String sFile) { |
f83884cc7d2f
Source Code re-formatted
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
7
diff
changeset
|
15 |
ClassLoader cl = getClass().getClassLoader(); |
f83884cc7d2f
Source Code re-formatted
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
7
diff
changeset
|
16 |
URL url = cl.getResource(sFile); |
f83884cc7d2f
Source Code re-formatted
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
7
diff
changeset
|
17 |
img = new ImageIcon(url).getImage(); |
f83884cc7d2f
Source Code re-formatted
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
7
diff
changeset
|
18 |
} |
0
e0dbaef72362
svn copy of the chess engine
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
19 |
|
13
f83884cc7d2f
Source Code re-formatted
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
7
diff
changeset
|
20 |
public Image getImage() { |
f83884cc7d2f
Source Code re-formatted
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
7
diff
changeset
|
21 |
return img; |
f83884cc7d2f
Source Code re-formatted
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
7
diff
changeset
|
22 |
} |
0
e0dbaef72362
svn copy of the chess engine
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
23 |
|
13
f83884cc7d2f
Source Code re-formatted
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
7
diff
changeset
|
24 |
public Dimension getPreferredSize() { |
f83884cc7d2f
Source Code re-formatted
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
7
diff
changeset
|
25 |
return new Dimension(img.getWidth(this), img.getHeight(this)); |
f83884cc7d2f
Source Code re-formatted
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
7
diff
changeset
|
26 |
} |
0
e0dbaef72362
svn copy of the chess engine
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
27 |
|
13
f83884cc7d2f
Source Code re-formatted
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
7
diff
changeset
|
28 |
public Dimension getMinimumSize() { |
f83884cc7d2f
Source Code re-formatted
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
7
diff
changeset
|
29 |
return getPreferredSize(); |
f83884cc7d2f
Source Code re-formatted
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
7
diff
changeset
|
30 |
} |
0
e0dbaef72362
svn copy of the chess engine
Markus Bröker <mbroeker@largo.homelinux.org>
parents:
diff
changeset
|
31 |
} |