Thanks to visit codestin.com
Credit goes to sourceforge.net

Menu

[r6]: / ImagePanel.java  Maximize  Restore  History

Download this file

18 lines (15 with data), 344 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
import java.awt.*;
import javax.swing.*;
public class ImagePanel extends JPanel {
ImageProvider ip;
public ImagePanel(ImageProvider _ip) {
ip = _ip;
setPreferredSize(
new Dimension(
ip.getImage().getWidth(),
ip.getImage().getHeight()));
}
public void paint(Graphics g) {
g.drawImage(ip.getImage(), 0, 0, null);
}
}