I'm a bit new to java programming and I wanted to make my application close when I click on a JMenuItem (named Exit). The code behind it is partly generated with NetBeans GUI builder.

Code:
Exit.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                CloseWindow(evt);
            }
        });
And the CloseWindow(evt) code

Code:
private void CloseWindow(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
    System.exit(0); 
}
But for some reason, the app won't close when I click the menu item.