d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > One Last Quick Question. > Please Help Its So Frustrating
Add Reply New Topic New Poll
Member
Posts: 4,448
Joined: Nov 23 2004
Gold: 1,644.50
Sep 22 2016 01:17am
Trying to make a JButton to close the application. This is the code I have
closeJButton = new JButton();
closeJButton.setBounds(280, 200, 80, 20);
closeJButton.setFont(new Font("Default", Font.PLAIN, 12));
closeJButton.setText("Close");
closeJButton.setForeground(black);
closeJButton.setBackground(white);
contentPane.add(closeJButton);
closeJButton.addActionListener(e->System.exit(0));

new ActionListener()
{
public void actionPerformed(ActionEvent event);
{
closeJButtonActionPerformed(event);
}
}
);




It is saying that

closeJButtonActionPerformed(event);
}
} <------------------- AddNumbers.java:160: error: ';' expected
}


);

What am I doing wrong this is all I have left to do please help me
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Sep 22 2016 10:49am
Your code is incomplete. You have to post the relevant code with braces in [CODE ]blocks if you want help with the compile error

This post was edited by carteblanche on Sep 22 2016 10:49am
Member
Posts: 20,928
Joined: Mar 18 2009
Gold: 435,910.13
Sep 22 2016 11:51pm
looks like you are missing a main method
Member
Posts: 7,324
Joined: Dec 22 2002
Gold: 1,261.00
Sep 23 2016 10:15am
From the little code you posted, looks like you have an extra closing bracket that doesn't belong there. Try changing
Code
closeJButtonActionPerformed(event);
}
}
);


to

Code
closeJButtonActionPerformed(event);
}
};
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll