This site requires JavaScript, please enable it in your browser!
Greenfoot back
Gevater_Tod4711
Gevater_Tod4711 wrote ...

2013/7/22

Fullscreen mode for Greenfoot

1
2
3
Gevater_Tod4711 Gevater_Tod4711

2013/8/6

#
I now got my fullscreen mode working: Greenfoot Full Screen Demo But there is another problem now (could it be any different?). Somehow the application frame seems to get blocked. Unfortunately I don't know much about the security using applets. Does anyone know why exactly the frame is blocked? Or does anyone know how to fix this?
davmac davmac

2013/8/6

#
Check the stack trace: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "exitVM.0") at java.security.AccessControlContext.checkPermission(AccessControlContext.java:366) at java.security.AccessController.checkPermission(AccessController.java:560) at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) at java.lang.SecurityManager.checkExit(SecurityManager.java:761) at javax.swing.JFrame.setDefaultCloseOperation(JFrame.java:394) at FullScreenWindow.<init>(FullScreenWindow.java:72) at FullScreenWorld.createFullScreenWindow(FullScreenWorld.java:165) at FullScreenWorld.<init>(FullScreenWorld.java:115) at ExampleWorld.<init>(ExampleWorld.java:13) at InitialisingWorld.act(InitialisingWorld.java:32) at greenfoot.core.Simulation.actWorld(Simulation.java:574) at greenfoot.core.Simulation.runOneLoop(Simulation.java:509) at greenfoot.core.Simulation.runContent(Simulation.java:215) at greenfoot.core.Simulation.run(Simulation.java:205) It looks like you're setting the close operation for the frame to "exit". An applet isn't allowed to exit the VM, so this causes an exception.
Gevater_Tod4711 Gevater_Tod4711

2013/8/6

#
Oh that sounds like it's pretty easy to fix. Thank you very much davmac. But I still got one question: Where can I get this stack trace? I never find it when I run a jar file or a applet on the webside.
davmac davmac

2013/8/6

#
Gevater_Tod4711 Gevater_Tod4711

2013/8/6

#
I now could fix some problems with the stack trace but now I again got a problem where I need help. The stack trace says: java.lang.NoClassDefFoundError: FullScreenWorld$1CursorDisappear at FullScreenWorld.manageCursor(FullScreenWorld.java:283) at FullScreenWorld.<init>(FullScreenWorld.java:117) at ExampleWorld.<init>(ExampleWorld.java:13) at InitialisingWorld.act(InitialisingWorld.java:32) at greenfoot.core.Simulation.actWorld(Simulation.java:574) at greenfoot.core.Simulation.runOneLoop(Simulation.java:509) at greenfoot.core.Simulation.runContent(Simulation.java:215) at greenfoot.core.Simulation.run(Simulation.java:205) Caused by: java.lang.ClassNotFoundException: FullScreenWorld$1CursorDisappear at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 8 more The problem occours because the class is not found. The class that is not found is declared locally. So my question: Are local classes not uploaded to the webside? Because offline everything works fine.
davmac davmac

2013/8/6

#
The local class is in the jar file, but it is incorrectly named as "FullScreenWorld$1cursorDisappear.class" (with a lower-case 'c' in 'cursor'). I guess you're on a system with a case-insensitive file system; you probably create the class initially with the wrong name, and then changed it. To fix the problem, just rename the file within your scenario manually (or delete it and re-compile) before exporting again.
Gevater_Tod4711 Gevater_Tod4711

2013/8/7

#
Ok I'll try that. Thanks davmac.
Gevater_Tod4711 Gevater_Tod4711

2013/8/7

#
The next problem: java.security.AccessControlException: access denied ("java.awt.AWTPermission" "watchMousePointer") at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at sun.plugin2.applet.AWTAppletSecurityManager.checkPermission(Unknown Source) at java.awt.MouseInfo.getPointerInfo(Unknown Source) at FullScreenMouseInfo.<init>(FullScreenMouseInfo.java:21) at FullScreenWindow.getMouseInfo(FullScreenWindow.java:158) at FullScreenWorld$1CursorDisappear.<init>(FullScreenWorld.java:256) at FullScreenWorld.manageCursor(FullScreenWorld.java:283) at FullScreenWorld.<init>(FullScreenWorld.java:117) at ExampleWorld.<init>(ExampleWorld.java:13) at InitialisingWorld.act(InitialisingWorld.java:32) at greenfoot.core.Simulation.actWorld(Simulation.java:574) at greenfoot.core.Simulation.runOneLoop(Simulation.java:509) at greenfoot.core.Simulation.runContent(Simulation.java:215) at greenfoot.core.Simulation.run(Simulation.java:205) Sounds like I'm not allowed to check the mouse state. Any ideas how to fix this?
davmac davmac

2013/8/7

#
I'm not sure what you mean by "check the mouse state" nor why you're doing that. Can't you just add mouse listeners to the window?
Gevater_Tod4711 Gevater_Tod4711

2013/8/7

#
I am just using mouseListeners. The stack trace says that there is a problem while creating a CursorDisappear object. This object has a field which is a FullScreenMouseInfo object. And while initialising this object there seems to be an access problem. The FullScreenMouseInfo object is only a interpreter for mouseEvent objects. A mouseListener sends the MouseEvents to the fullscreenwindow where they are interpreted with a FullScreenMouseInfo object. So I am just using a mouseListener. I don't get why this isn't working. Because again offline everything works perfectly.
davmac davmac

2013/8/7

#
The stack trace shows that you are calling "java.awt.MouseInfo.getPointerInfo()". This is not the same as using a mouse listener. The events passed to the mouse listener contain the mouse pointer location and button state.
Gevater_Tod4711 Gevater_Tod4711

2013/8/7

#
Oh I forgot to delete this. I was just trying to use this method and forgot that I found a better way.
Gevater_Tod4711 Gevater_Tod4711

2013/8/7

#
Hallelujah!!!!!!!!!! I got it working. Thank you very much for all the help and all the time you invested. I think the result is realy good. May you have a look here.
darkmist255 darkmist255

2013/8/7

#
Great work!
Gevater_Tod4711 Gevater_Tod4711

2013/8/8

#
@darkmist255 Thanks. It was realy not easy but the result is nice.
You need to login to post a reply.
1
2
3