Skip to content
Browse files

Remove quit button

  • Loading branch information...
1 parent 21061b5 commit da37c030efff51211c8ec181ecf7602ea15ed7c1 @aardvarrk aardvarrk committed Jan 25, 2013
Showing with 0 additions and 38 deletions.
  1. BIN Menuworld.class
  2. +0 −1 Menuworld.java
  3. BIN Quitbutton.class
  4. +0 −4 Quitbutton.ctxt
  5. +0 −33 Quitbutton.java
View
BIN Menuworld.class
Binary file not shown.
View
1 Menuworld.java
@@ -28,7 +28,6 @@ public Menuworld()
addObject(new Scoreboardbutton2(), 120, 80);
addObject(new Scoreboardbutton3(), 40, 135);
addObject(new Scoreboardbutton4(), 120, 135);
- addObject(new Quitbutton(), 145, 150);
//images of games
addObject(new GameImage1(), 40, 50);
View
BIN Quitbutton.class
Binary file not shown.
View
4 Quitbutton.ctxt
@@ -1,4 +0,0 @@
-#BlueJ class context
-comment0.params=
-comment0.target=void\ close()
-numComments=1
View
33 Quitbutton.java
@@ -1,33 +0,0 @@
-import java.awt.Toolkit;
-import java.awt.event.WindowEvent;
-import java.lang.reflect.Field;
-import greenfoot.core.WorldHandler;
-import greenfoot.export.GreenfootScenarioViewer;
-import greenfoot.platforms.WorldHandlerDelegate;
-import greenfoot.platforms.standalone.WorldHandlerDelegateStandAlone;
-import javax.swing.RootPaneContainer;
-import javax.swing.JFrame;
-
-public class Quitbutton extends Buttons {
-
- public void close() throws NoSuchFieldException,java.lang.IllegalAccessException{
- WorldHandler wh = WorldHandler.getInstance();
- Field whd_get = WorldHandler.class.getDeclaredField("handlerDelegate");
- whd_get.setAccessible(true);
- WorldHandlerDelegate w = (WorldHandlerDelegate)whd_get.get(wh);
- if(w instanceof WorldHandlerDelegateStandAlone)
- {
- WorldHandlerDelegateStandAlone wsa = (WorldHandlerDelegateStandAlone)w;
- Field gsv_get = WorldHandlerDelegateStandAlone.class.getDeclaredField("viewer");
- gsv_get.setAccessible(true);
- GreenfootScenarioViewer gsv = (GreenfootScenarioViewer)gsv_get.get(wsa);
- Field f = GreenfootScenarioViewer.class.getDeclaredField("rootPaneContainer");
- f.setAccessible(true);
- System.out.println(f.get(gsv).getClass());
- JFrame rpc = (JFrame)f.get(gsv);
- WindowEvent wev = new WindowEvent(rpc, WindowEvent.WINDOW_CLOSING);
- Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(wev);
- }
- else return; //Not stand-alone, don't continue.
- }
-}

0 comments on commit da37c03

Please sign in to comment.
Something went wrong with that request. Please try again.