Draxion

Untitled

Mar 22nd, 2015
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. Image background = new ImageIcon(ImageIO.read(new File("src\\invasion_city.jpg"))).getImage();
  2. int sxdim = 179;
  3. int sydim = 117;
  4. int shipxcoord, shipycoord;
  5.  
  6. public Invasion(double w, double h) throws IOException {
  7. shipxcoord = ((int) w - sxdim) / 2;
  8. shipycoord = ((int) h - sxdim) / 2;
  9. }
  10.  
  11. @Override
  12. public void paintComponent(Graphics g) {
  13. super.paintComponent(g);
  14. g.drawImage(getShip(), shipxcoord, shipycoord, sxdim, sydim, null);
  15. }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment