-
Notifications
You must be signed in to change notification settings - Fork 0
/
ImagePanel.java
36 lines (30 loc) · 935 Bytes
/
ImagePanel.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import javax.swing.JPanel;
import com.digitalpersona.uareu.*;
import com.digitalpersona.uareu.Fid.Fiv;
public class ImagePanel
extends JPanel
{
private static final long serialVersionUID = 5;
private BufferedImage m_image;
private int w;
private int h;
public void showImage(Fid image){
Fiv view = image.getViews()[0];
m_image = new BufferedImage(view.getWidth(), view.getHeight(), BufferedImage.TYPE_BYTE_GRAY);
m_image.getRaster().setDataElements(0, 0, view.getWidth(), view.getHeight(), view.getImageData());
w = view.getWidth();
h = view.getHeight();
repaint();
}
public void paint(Graphics g) {
if (isOpaque()){
Graphics dc = g.create();
dc.setColor(getBackground());
dc.fillRect(0, 0, getWidth(), getHeight());
dc.dispose();
}
g.drawImage(m_image, (400-w)/2, (500-h)/2, null);
}
}