I like to develop in Java but also want compatibility with the global menu? Is there a way? Please help.
|
There is a library called java-gnome (a java gtk wrapper) that allows your apps to behave like all of the native apps. It provides all the glory to them: native widgets, global menu, etc. The library is available on the ubuntu repositories:
The goal of the library is to develop a rich Java + Gnome experience. Beware, that if you use this library your app will lose the multiplatform feature of Java (since it'll be tied to java-gnome). Here is a sample app (that comes with java-gnome) displaying the menu integration:
|
|||||
|
|
That is normally done at the toolkit level, for instance in GTK or Qt. So the intended way to do it would be to patch Swing, if that's the GUI toolkit you're using. However, all the Unity components communicate using DBus, so if you really wanted to, you could do it yourself by implementing the DBus API yourself. If you want to do this, you might want to have a look at libdbusmenu and see how it works. |
|||||||
|
|
Not a fix for you, but FYI: I filed Ubuntu bug #984916 to track the fact that Swing menus are not (semi-)automatically integrated into the global menu. |
|||
|
|
|
Try Ayatana. You may find instructions here: http://hanynowsky.wordpress.com/2012/05/12/integration-of-java-swing-applications-with-unity-global-menu-in-ubuntu-12-04/ All you have to do is to import the Java Ayatana Library and call it in your main JFrame class. This actually implies the addition of the following couple of lines in your code (as well as importing Ayatana classes):
Here is an example:
And the most important thing is that your application is still cross-platform. I have tested the above example in both Ubuntu 12.04 LTS and Windows XP. |
||||
|
|