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.
And the CloseWindow(evt) codeCode:Exit.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { CloseWindow(evt); } });
But for some reason, the app won't close when I click the menu item.Code:private void CloseWindow(java.awt.event.MouseEvent evt) { // TODO add your handling code here: System.exit(0); }


Reply With Quote


Bookmarks