Below I have the following code, so that when someone clicks on the \"Close\", the window will close. Below that is another exit button on the same menu bar, simply for redundan
Use a MouseAdapter and override the methods that you want.
closeFile.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent arg0) { System.exit(0); } });