Advertisement
Guest User

Untitled

a guest
Apr 29th, 2016
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. package me.Joey402;
  2. import java.awt.Graphics;
  3. import java.awt.Graphics2D;
  4. import java.awt.image.BufferedImage;
  5. import java.io.File;
  6. import java.io.IOException;
  7. import javax.imageio.ImageIO;
  8. import javax.swing.JFrame;
  9. public class StickFrame extends JFrame{
  10. /**
  11. *
  12. */
  13. private static final long serialVersionUID = 1L;
  14. public static BufferedImage bg;
  15. public static void main(String[] args){
  16. try{
  17. File file = new File("bg.png");
  18. bg = ImageIO.read(file);
  19. } catch (IOException e){
  20. e.printStackTrace();
  21. }
  22. new StickFrame();
  23. }
  24. public StickFrame(){
  25. init();
  26. }
  27. public void init(){
  28. setSize(1100,900);
  29. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  30. setLocationRelativeTo(null);
  31. setVisible(true);
  32. }
  33. public void paint(Graphics g){
  34. super.paint(g);
  35. Graphics2D g2 = (Graphics2D) g;
  36. // Background
  37. g2.drawImage(bg, 0, 0, this);
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement