-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFacePanel.java
More file actions
55 lines (49 loc) · 1.39 KB
/
Copy pathFacePanel.java
File metadata and controls
55 lines (49 loc) · 1.39 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import javax.swing.JPanel;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author sony
*/
public class FacePanel extends JPanel{
/**
*
*/
private static final long serialVersionUID = 1L;
private BufferedImage image;
int count = 0;
private int x, y, width,height;
public FacePanel(){
super();
}
//daireSet
public void setRectParameter(int x1, int y1,int width1, int height1){
x = x1;
y = y1;
width = width1;
height = height1;
}
public void setFace(BufferedImage img){
image = img;
}
public void paintComponent(Graphics g){
super.paintComponent(g);
if (this.image == null) {
System.out.println("Görüntü hazır değil !");
return;
}
g.drawImage(this.image, 10, 10, this.image.getWidth(),this.image.getHeight(),null);
g.setColor(Color.green);
g.drawRect(x, y, width, height);
System.out.println("(x,y) ="+ x+", "+y);
g.setFont(new Font("arial", 2, 20));
g.drawString("Resim Sayısı : "+ (count++),50, 50);
}
}