views:

42

answers:

2

So I made a standard swing application in Netbeans 6.8 but I can't find where the resource file that defines the localized string for the Exit menu item under File.

It doesn't seem to be defined among the resource files in <project>/resources. Is this a standard string somewhere or am I missing something?

A: 

Are you just trying to shut down your application in such a way that you are able to do clean-up tasks before the system shuts down? If so then on the Java Sun site they say that you need to override the shutdown method; specifically :

 @Override
protected void shutdown() {
    // The default shutdown saves session window state.
    super.shutdown();
    // Now perform any other shutdown tasks you need.
}

This is located at this location

Kyra
No, I was asking about how the JMenuItem for exit gets its localized string from. So this doesn't answer my question.
Spoike
+1  A: 

The "Exit" string doesn't get defined as a localized string like the File menu item -- it gets generated into code through the Netbeans GUI builder. That is why you don't see it in the properties file.

If you open the file {ProjectName}View.java you can see that it gets defined through the netbeans GUI builder. Click on the file menu and then the exit menu item in the GUI builder and you can look at the properties of the swing item. One of the properties is the text of the JMenuItem.

Then these properties get generated into code.