, Swing , :
public class JImagePanelExample extends JPanel {
private BufferedImage image;
private Graphics2D drawingBoard;
private int x, y;
public JImagePanelExample(BufferedImage image, int x, int y) {
super();
this.image = image;
drawingBoard = image.createGraphics();
drawingBoard.drawLine(0, 10, 35, 55);
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawImage(image, x, y, null);
}
}
Swing, 2D, BufferedImage Graphics2D.