import javax.swing.*;

public class ShipButton extends JButton {
    Ship ship;

    public ShipButton(Ship ship, BoardDisplay boardDisplay) {
        super(ship.getName());
        this.ship = ship;
        this.addActionListener((e)->{
            boardDisplay.selectCurrentShip(this.ship);
            this.setEnabled(false);
        });
    }

    public void buttonPressed() {
        this.setEnabled(!ship.isPlaced());
    }
}
