K
KDawg44
Hi,
I am receiving an error when I am compiling my main gui class for a
BattleShip game I am writing for my grad class.
I get this error:
Compiling 1 source file to /root/school/CS654/JavaClasses/Battleship/
build/classes
/root/school/CS654/JavaClasses/Battleship/src/MainGUI.java:2682:
unreported exception java.lang.Exception; must be caught or declared
to be thrown
btnP2x2ActionPerformed(evt);}
on this line:
btnP2x2.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent
evt) {
btnP2x2ActionPerformed(evt);}
});
The highlighted portion is the evt in btnP2x2ActionPerformed(evt);}
and here is the btnP2x2ActionPerformed() method it is calling.
private void btnP2x2ActionPerformed(java.awt.event.ActionEvent
evt) throws Exception {
PlaceShip(2,2, btnP2x2);
}
private void PlaceShip(int x, int y, javax.swing.JButton btn) throws
Exception {
METHOD CONTENTS
Thanks for any and all help.
I am receiving an error when I am compiling my main gui class for a
BattleShip game I am writing for my grad class.
I get this error:
Compiling 1 source file to /root/school/CS654/JavaClasses/Battleship/
build/classes
/root/school/CS654/JavaClasses/Battleship/src/MainGUI.java:2682:
unreported exception java.lang.Exception; must be caught or declared
to be thrown
btnP2x2ActionPerformed(evt);}
on this line:
btnP2x2.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent
evt) {
btnP2x2ActionPerformed(evt);}
});
The highlighted portion is the evt in btnP2x2ActionPerformed(evt);}
and here is the btnP2x2ActionPerformed() method it is calling.
private void btnP2x2ActionPerformed(java.awt.event.ActionEvent
evt) throws Exception {
PlaceShip(2,2, btnP2x2);
}
private void PlaceShip(int x, int y, javax.swing.JButton btn) throws
Exception {
METHOD CONTENTS
Thanks for any and all help.