Where do I localize strings in some of the menu items with Netbeans?
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 somewher开发者_运维问答e or am I missing something?
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.
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
精彩评论