/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package myimages;
/**
*
* @author Tomáš
*/
import java.awt.*;
import java.awt.image.*;
import javax.swing.*;
import java.util.*;
public class MyImagePanel extends JPanel{
BufferedImage img = null;
java.util.List<Point> points = new
ArrayList<Point>();
public MyImagePanel(){
}
public void paint(Graphics g) {
g.drawImage(img, 0, 0, null);
for(Point p : points){
g.drawLine(p.x-3, p.y-3, p.x+3, p.y+3);
g.drawLine(p.x+3, p.y-3, p.x-3, p.y+3);
}
}
public Dimension getPreferredSize() {
if (img == null) {
return new Dimension(600,600);
} else {
return new
Dimension(img.getWidth(null), img.getHeight(null));
}
}
}