Advertisement
xtroyerall

MeuFrame

Oct 1st, 2014
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.17 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package UI;
  7.  
  8. import genius.FundoDoJogo;
  9. import java.awt.Dimension;
  10. import java.awt.Frame;
  11. import java.awt.Graphics;
  12. import java.awt.Graphics2D;
  13. import java.awt.Toolkit;
  14. import java.io.IOException;
  15. import java.util.logging.Level;
  16. import java.util.logging.Logger;
  17.  
  18. /**
  19.  *
  20.  * @author Gustavo
  21.  */
  22. public class MeuFrame extends Frame {
  23.  
  24.     private FundoDoJogo fundoDoJogo;
  25.  
  26.     public MeuFrame() {
  27.         Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
  28.         this.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2);
  29.         this.setVisible(true);
  30.         this.setSize(500, 500);
  31.  
  32.         try {
  33.             fundoDoJogo = new FundoDoJogo();
  34.         } catch (IOException ex) {
  35.             Logger.getLogger(MeuFrame.class.getName()).log(Level.SEVERE, null, ex);
  36.         }
  37.  
  38.     }
  39.  
  40.     @Override
  41.     public void paint(Graphics g) {
  42.         Graphics2D g2 = (Graphics2D) g;
  43.         fundoDoJogo.desenha(g2);
  44.     }
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement