Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Image background = new ImageIcon(ImageIO.read(new File("src\\invasion_city.jpg"))).getImage();
- int sxdim = 179;
- int sydim = 117;
- int shipxcoord, shipycoord;
- public Invasion(double w, double h) throws IOException {
- shipxcoord = ((int) w - sxdim) / 2;
- shipycoord = ((int) h - sxdim) / 2;
- }
- @Override
- public void paintComponent(Graphics g) {
- super.paintComponent(g);
- g.drawImage(getShip(), shipxcoord, shipycoord, sxdim, sydim, null);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment