Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.Image;
- import javax.swing.ImageIcon;
- import javax.swing.JApplet;
- public class SetImage extends JApplet {
- private Image image;
- @Override
- public void init() {
- image = null;
- }
- @Override
- public void paint(Graphics g) {
- Graphics2D g2d = (Graphics2D) g;
- ImageIcon icon = new ImageIcon(SetImage.class.getResource("avatar.png"));
- image = icon.getImage();
- g2d.drawImage(image, 0, 0, null);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement