osx - Set a dynamic Apple menu title for Java program in NetBeans 7.4 -


i inherited java app built (i believe) in eclipse, i'm modifying using netbeans 7.4. want set main menu title shows on mac next apple menu. right name mainform, want change dynamically contents of specific text file (name.txt). i've looked tons of info on project.properties, ant scripts, , like, can't find definitive (and cross-platform) way set main menu title. have function in code returns name, can use if there's place it. in advance!

i have found in order set app name in mac os x application menu, , avoid having show name of java project, have set in application cycle, using system.setproperty("apple.awt.application.name", "your app name");

here's how have mine set in "main" java method launches application:

public static void main(string[] args)  {     // application menu mac os x must set in cycle     string opsysname = system.getproperty("os.name").tolowercase();     if (opsysname.contains("mac")) {         // set name of app in mac app menu:         system.setproperty("apple.awt.application.name", "your app name");         //to show menu bar @ top of screen:         system.setproperty("apple.laf.usescreenmenubar", "true");         // show more mac-like file dialog box         system.setproperty("apple.awt.filedialogfordirectories", "true");         //underlying laf:         javax.swing.uimanager.getinstalledlookandfeels();          // other set-up code goes here     }     else {  // not on mac os x         // set-up code non-mac systems     }      java.awt.eventqueue.invokelater(() -> {         // run program      });  } 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -