Changeset 537
- Timestamp:
- 11/26/13 16:06:38 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/items/widgets/JfxBrowser.java
r536 r537 14 14 import java.net.URL; 15 15 import java.net.URLClassLoader; 16 import java.util.List;17 16 18 17 import javax.swing.JPanel; … … 47 46 static Class WebEngine; 48 47 static Method WebEngineLoad; 48 static Method WebEngineGetLocation; 49 49 50 50 static { 51 51 String javaLibDir = System.getProperty("java.home") + File.separator + "lib" + File.separator; 52 52 try { 53 System.out.println(javaLibDir);54 53 ClassLoader classLoader = ClassLoader.getSystemClassLoader(); 55 54 … … 61 60 addURL.invoke(classLoader, jar.toURI().toURL()); 62 61 63 System.out.println(System.getProperty("java.class.path"));64 65 62 JFXPanel = Class.forName("javafx.embed.swing.JFXPanel", false, classLoader); 66 67 final File f = new File(JFXPanel.getProtectionDomain().getCodeSource().getLocation().getPath());68 System.out.println(f.getPath());69 63 70 64 Platform = classLoader.loadClass("javafx.application.Platform"); … … 88 82 WebEngine = classLoader.loadClass("javafx.scene.web.WebEngine"); 89 83 WebEngineLoad = WebEngine.getMethod("load", String.class); 84 WebEngineGetLocation = WebEngine.getMethod("getLocation"); 90 85 91 86 … … 212 207 213 208 public JfxBrowser(Text source, String[] args) { 214 // Testing proxy auth215 super(source, new WebBrowserPanel( "http://stackoverflow.com"), -1, 500, -1, -1, 300, -1);209 // Initial page is either the page stored in the arguments (if there is one stored) or Google 210 super(source, new WebBrowserPanel((args != null && args.length > 0) ? args[0] : "http://google.com"), -1, 500, -1, -1, 300, -1); 216 211 217 212 _browser = (WebBrowserPanel) _swingComponent; … … 221 216 try { 222 217 WebEngineLoad.invoke(WebViewGetEngine.invoke(this._browser.webview), url); 223 224 218 } catch (IllegalAccessException e) { 225 219 e.printStackTrace(); … … 233 227 @Override 234 228 protected String[] getArgs() { 235 return null; 236 } 237 238 @Override 239 public void setSourceData(List<String> data) { 240 super.setSourceData(data); 241 if (data != null && data.size() > 0) { 242 navigate(data.get(0)); 243 } 244 } 245 246 @Override 247 protected List<String> getData() { 248 return _textRepresentation.getData(); 229 String[] r = null; 230 if (this._browser.webview != null) { 231 try { 232 r = new String[] { (String) WebEngineGetLocation.invoke(WebViewGetEngine.invoke(this._browser.webview)) }; 233 } catch (IllegalAccessException e) { 234 e.printStackTrace(); 235 } catch (IllegalArgumentException e) { 236 e.printStackTrace(); 237 } catch (InvocationTargetException e) { 238 e.printStackTrace(); 239 } catch (SecurityException e) { 240 e.printStackTrace(); 241 } 242 } 243 return r; 249 244 } 250 245 }
Note:
See TracChangeset
for help on using the changeset viewer.