How can I put a swt.browser inside of a Jpanel?
There is SWTSwing, although it's not clear if it supports the Browser component.
If you're looking for a native browser in Java, the jdic project can render Internet Explorer into a swing component. See https://jdic.dev.java.net/documentation/incubator/JDICplus/index.html
Possibly more complete and current is the embedded browser support in NetBeans.
http://wiki.netbeans.org/EmbeddedBrowserPlan68
Related
I am looking for an open source browser component like the ones in DJ Project (http://djproject.sourceforge.net/ns/index.html) for SWING. I tried using DJ Project (which I learned about from Best Java/Swing browser component?), but I noticed that it hasn't been updated in recent months.
If there is an easy way to make a web browser using JInternalFrame, that would be awesome as well.
Thank you in advance!
I have Google Chrome Frame installed on my Windows XP + IE8 machine.
When I navigate to chrome frame enabled page using IE8, it works.
But when I navigate to the site through a Java application that uses DJ Native Swing, the add-on is not activated.
The application uses SWT version 3.740.
Is it possible enable Chrome Frame in the DJ Native Swing browser?
Try imbedding WebKit layout engine with V8 JavaScript engine into Swing.
Getting Chrome Browser in java Applications
According to the documentation at JavaDoc: JWebBrowser it only supports IE and Mozilla:
A native web browser, using Internet Explorer or Mozilla on Windows, and Mozilla on other platforms.
However, according to the code it implements the "XULRunner Runtime" NSOption which according to The XULRunner Wikipedia article XULRunner appears in the credits for Chrome therefore it may suit your requirements to use Mozilla but it wont be Chrome.
The methods JWebBrowser.useWebkitRuntime() and JWebBrowser.useXULRunnerRuntime() seem to be the only built in options but you can use the NSOption class to define your own options if you know the correct variable names to pass.
I hope this helps
First, SWT control for Browser is what DJ Native Swing is using, but it also has all sorts of glue code to make it thread safe with Swing. Thus, changing to pure SWT would yield the same problems, plus threading issues to solve.
About Google Chrome Frame in SWT, and thus in DJ Native Swing, there is currently no support in SWT itself. See this bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=317322
SWT, and DJ Native Swing, allow to create one's own ActiveX bridge. Maybe you could create your own component for Google Chrome Frame ActiveX on windows, similar to what DJ Native Swing does for the Windows Media Player component.
Last time in Swing project when we had to integrate browser into Swing application, we finally used Eclipse SWT component, that defaulted to IE. That made build for Windows only, but it worked, and eliminated some Swing bugs.
Try using Eclipse SWT control for browser.
Multi-window applications often have a main-window, and all other windows are kind of 'parented' to it. Minimizing such a sub-window will hide its content and show the title-bar at the bottom-left of the screen. Also, these windows do not have their own Icon in the Task-bar, only the main-window does.
How can I make a window being attached this way to another window?
If that is possible, is it also possible without a referenfe to the actual main window?
#2: I'm embedding Java into such an application and I would like to be able to use awt or swing additionally to the native dialogs, which have this behavior by default.
See How to Use Internal Frames.
have look at JInternalFrames for MDI application
read Oracle tutorial, try code example
I'm working on an application that uses the SWT Browser widget to display an HTML page with some JavaScript in it. The JavaScript tries to use window.resizeTo to change the size of the window, but it currently isn't having any effect.
I've fiddled with the browser settings, and it doesn't seem to be an issue with the underlying browser; switching between Mozilla and Internet Explorer rendering engines has no effect. I suspect that SWT simply doesn't automatically re-size the window in response to JavaScript functions.
I can easily re-size the window from my Java code, but I need to know when to re-size it, and how big JavaScript wants it to be. Does SWT provide a way to listen for this? If so, how?
I still don't know of any way to get this information, but a work-around is to change SWT versions. Some of them implement JavaScript's window.resizeTo automatically, and some of them do not.
Sometime ago I was facing the problem the other way around: how to drag an item (folder/file) from an explorer window (be it windows explorer, linux nautilus etc.) to the browser window - that is, the drag starts in one application and ends in the browser. Since I had control over the browser, I was able to intercept the dragend event: the one which interested me.
Now, I want to do this from the browser to the file explorer application: much like when you drag an image from firefox and drop it in a folder.
My main problem is that while I can check when the drag event exited the browser window, I have no ideea how to get the location where the drag event finished.
My ideea is to create a signed java applet and somehow track the mouse movement on the desktop - but this seems a little more than overkill.
Any pointers on this?
According to your justification is is not simple, but it can be managed. There is class called DataFlavor. You had to use D&D mechanism introduce in java using Transferable objects and provide correct mime-types and corresponding conversion. The problem is which mime-type will be accepted by explorer. I hope this help.
You won't be able to do this with JavaScript. JS is sandboxed in the browser and can't interact with anything outside.