bekovski

mamo

Feb 23rd, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.87 KB | None | 0 0
  1. package pack1;
  2.  
  3. import java.awt.image.BufferedImage;
  4.  
  5. import java.io.File;
  6. import java.io.IOException;
  7.  
  8. import javax.imageio.ImageIO;
  9. import javax.swing.ImageIcon;
  10. import javax.swing.JFrame;
  11. import javax.swing.JLabel;
  12.  
  13. public class Var {
  14.  
  15.     static JFrame jf1;
  16.     static int screenwidth = 800, screenheight = 600;
  17.     static int backgroundY1 = 0, backgroundY2 = -600;
  18.     static boolean moveup = false, movedown = false, moveright = false, moveleft = false;
  19.     static Label lbl1;
  20.  
  21.     static BufferedImage ib1, ib2;
  22.  
  23.     public Var() {
  24.  
  25.         try {
  26.             // Background
  27.             ib1 = ImageIO.read(new File("rsc/b1.jpg"));
  28.             ib2 = ImageIO.read(new File("rsc/b1.jpg"));
  29.         } catch (IOException e) {
  30.             e.printStackTrace();
  31.             System.out.println("Bild konnte nicht geladen werden");
  32.         }
  33.        
  34.         jf1 = new JFrame();
  35.         jf1.setVisible(true);
  36.         jf1.add(new Label(new ImageIcon(ib1)));
  37.     }
  38.    
  39.    
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment