Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.Joey402;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.image.BufferedImage;
- import java.io.File;
- import java.io.IOException;
- import javax.imageio.ImageIO;
- import javax.swing.JFrame;
- public class StickFrame extends JFrame{
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public static BufferedImage bg;
- public static void main(String[] args){
- try{
- File file = new File("bg.png");
- bg = ImageIO.read(file);
- } catch (IOException e){
- e.printStackTrace();
- }
- new StickFrame();
- }
- public StickFrame(){
- init();
- }
- public void init(){
- setSize(1100,900);
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- setLocationRelativeTo(null);
- setVisible(true);
- }
- public void paint(Graphics g){
- super.paint(g);
- Graphics2D g2 = (Graphics2D) g;
- // Background
- g2.drawImage(bg, 0, 0, this);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement