I don’t know if someone else have this issue.
I am trying to setup a JME game in the MacAppStore and I need to add a “Windows” menu in the menu bar. However, I could not find a way to do it the standard way but I could use a Jframe following the example in the tutorial. So far so good on Windows.
However, when I run the code on the mac I get this
is there something else I should do to avoid this? I tried renderers, viewports, camera, etc… and still have this issue…
I am using JME3.1 Alpha-3 (the alpha has some things I use now)
Thanks
Edit: It appears that it’s an error using LWGL, with openGL I get it working (although everything is dark). but LWGL works fine without Jframe.
Edit2: I have the same problem in JME 3.0
Ok, after fighting with Frame and JFrame I found a workaround without resorting to Frame but use apple’s Java library. The only issue is that there may be problems in Netbeans or the SDK when you build with com.apple.eawt
package, so this workaround helps to add the Window Menu without using Frame.
private void ProcessAppleControl()
{
try {
Class<?> clazz = Class.forName("com.apple.eawt.Application");
Method method = clazz.getMethod("getApplication");
Object obj = method.invoke(null);
method = clazz.getMethod("setDefaultMenuBar", JMenuBar.class);
method.invoke(obj, CreateMenuBar()); //Your custom MenuBar
method = clazz.getMethod("enableSuddenTermination");
method.invoke(obj);
} catch (ClassNotFoundException | NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
Logger.getLogger(DominoGame.class.getName()).log(Level.SEVERE, null, ex);
}
}
1 Like