Index: /trunk/src/org/expeditee/items/widgets/JfxBrowser.java
===================================================================
--- /trunk/src/org/expeditee/items/widgets/JfxBrowser.java	(revision 532)
+++ /trunk/src/org/expeditee/items/widgets/JfxBrowser.java	(revision 533)
@@ -7,4 +7,5 @@
 import java.awt.event.ComponentListener;
 import java.io.File;
+import java.io.IOException;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
@@ -16,5 +17,4 @@
 
 import javax.swing.JPanel;
-import javax.swing.border.EmptyBorder;
 
 import org.expeditee.items.Text;
@@ -25,8 +25,6 @@
  * @author ngw8
  * @author jts21
- * 
  */
 public class JfxBrowser extends DataFrameWidget {
-
 	private WebBrowserPanel _browser;
 
@@ -52,8 +50,8 @@
 	static {
 		String javaLibDir = System.getProperty("java.home") + File.separator + "lib" + File.separator;
-
 		try {
-
+			System.out.println(javaLibDir);
 			ClassLoader classLoader = ClassLoader.getSystemClassLoader();
+
 
 			File jar = new File(javaLibDir + "jfxrt.jar");
@@ -63,9 +61,17 @@
 			addURL.invoke(classLoader, jar.toURI().toURL());
 
-			
+			System.out.println(System.getProperty("java.class.path"));
+
 			JFXPanel = Class.forName("javafx.embed.swing.JFXPanel", false, classLoader);
+
+			final File f = new File(JFXPanel.getProtectionDomain().getCodeSource().getLocation().getPath());
+			System.out.println(f.getPath());
 
 			Platform = classLoader.loadClass("javafx.application.Platform");
 			PlatformRunLater = Platform.getMethod("runLater", Runnable.class);
+
+			// Setting JFX to not exit when all panels are hidden, otherwise moving, resizing and changing frames will
+			// cause JFX to exit, preventing JFX elements from displaying at all
+			Platform.getMethod("setImplicitExit", boolean.class).invoke(null, false);
 
 			Group = classLoader.loadClass("javafx.scene.Group");
@@ -83,4 +89,5 @@
 			WebEngineLoad = WebEngine.getMethod("load", String.class);
 
+
 		} catch (MalformedURLException e) {
 			e.printStackTrace();
@@ -96,4 +103,6 @@
 			e.printStackTrace();
 		} catch (InvocationTargetException e) {
+			e.printStackTrace();
+		} catch (IOException e) {
 			e.printStackTrace();
 		}
@@ -118,7 +127,9 @@
 				this.add((Component) jfxPanel);
 
+				// Removing the gap between the top of the panel and the JFXPanel
 				((FlowLayout) this.getLayout()).setVgap(0);
-				this.setBackground(Color.cyan);
-				this.setBorder(new EmptyBorder(0, 0, 0, 0));
+
+				// Setting bg color to be the same as bg color of widgets when they're being dragged/resized
+				this.setBackground(new Color(100, 100, 100));
 
 				PlatformRunLater.invoke(null, new Runnable() {
@@ -140,5 +151,5 @@
 
 		/**
-		 * Sets up the browser frame. JFX requires it to be run on a new thread.
+		 * Sets up the browser frame. JFX requires this to be run on a new thread.
 		 * 
 		 * @param url
@@ -147,14 +158,10 @@
 		private void initFx(String url) {
 			try {
-				Object group = Group.newInstance();
-				Object scene = SceneConstructor.newInstance(group);
+				this.webview = WebView.newInstance();
+				WebViewSetPrefSize.invoke(this.webview, this.getWidth(), this.getHeight());
+
+				Object scene = SceneConstructor.newInstance(this.webview);
 
 				JFXPanelSetScene.invoke(jfxPanel, scene);
-
-				this.webview = WebView.newInstance();
-
-				WebViewSetPrefSize.invoke(this.webview, this.getWidth(), this.getHeight());
-
-				((List) GroupGetChildren.invoke(group)).add(this.webview);
 
 				WebEngineLoad.invoke(WebViewGetEngine.invoke(this.webview), url);
@@ -167,4 +174,6 @@
 			} catch (InstantiationException e) {
 				e.printStackTrace();
+			} catch (SecurityException e) {
+				e.printStackTrace();
 			}
 		}
@@ -180,4 +189,6 @@
 		@Override
 		public void componentResized(ComponentEvent e) {
+			// Webview is initialized in a 'run later' thread, so must check that it has actually been created before
+			// trying to resize
 			if (webview != null) {
 				try {
@@ -189,7 +200,8 @@
 				} catch (InvocationTargetException e1) {
 					e1.printStackTrace();
+				} catch (SecurityException e1) {
+					e1.printStackTrace();
 				}
 			}
-			
 		}
 
@@ -197,17 +209,10 @@
 		public void componentShown(ComponentEvent e) {
 		}
-
-
 	}
 
 	public JfxBrowser(Text source, String[] args) {
-		super(source, new WebBrowserPanel("http://waikato.ac.nz"), 100, 500, -1, 100, 300, -1);
+		super(source, new WebBrowserPanel("http://waikato.ac.nz"), -1, 500, -1, -1, 300, -1);
 
 		_browser = (WebBrowserPanel) _swingComponent;
-	}
-
-	@Override
-	protected String[] getArgs() {
-		return null;
 	}
 
@@ -222,4 +227,9 @@
 			e.printStackTrace();
 		}
+	}
+
+	@Override
+	protected String[] getArgs() {
+		return null;
 	}
 
@@ -236,4 +246,3 @@
 		return _textRepresentation.getData();
 	}
-	
 }
