Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
Is there a way to embed a browser in Java? more specifically, is there a library that can emulate a browser?
Since JavaFX 2.0 you can use now webview
I believe JWebPane is going to be the official way to embed a browser into a java app. Its based on the open sourced engine - WebKit, which is used in Apples Safari and Googles Chrome browsers.See this blog for details.
You may try this: https://jdic.dev.java.net/
(source: java.net)
Or this: http://lobobrowser.org/java-browser.jsp
(source: lobobrowser.org)
You could use SWT for your GUI. Its Browser control allows you to embed IE, Mozilla or Safari (depending on the platform you're running in) with little pain.
By far the most robust embeddable browser I am familiar with is the one in SWT.
In fact, it is so flexible that the JavaDoc hover you can see in Eclipse is actually a browser, and the JavaDoc view actually supports things like animation!
The only risk with using SWT is that there are different versions of the SWT library for different platforms. I'm not sure if there is a singl jar you could include to cover everyone.
Take a look at
https://xhtmlrenderer.dev.java.net/
JxBrowser has not been mentionned yet. It embed either Mozilla Firefox (Gecko), Apple Safari (WebKit) or Internet Explorer. Programmer's Guide
You could also try the JWebBrowser from DJ Native Swing: http://djproject.sourceforge.net/ns
I have successfully opened a browser from Java using SWT. You can find code examples of how to use SWT to open a Browser window. It's very easy to do.
You can embed a browser in a Swing/AWT GUI using the JDIC API. I don't see any mention of OS X, so it may not be of use to you.
You can try Webrenderer or Ice Browser
If you need a pure Java solution then you can try JWebEngine. It render HTML 4 very good. You can use it in an applet, Java webstart and on any platform. The using is very simple.
You could try a JEditorPane, it doesn't interpret advanced HTML, nor Javascript, nor advanced CSS, but you can write that part yourself, called the EditorKit. That is the class/object that is consulted by the JEditorPane or how it has to display its content.
I know its possible, because I tried and failed (:P), but it could be outdated or deprecated by now, I don't know.
Maybe Chromium Embedded Framework is an option for you. Specific to Java there is
javacef for SWT: https://github.com/wjywbs/javacef
java-cef for AWT: https://bitbucket.org/chromiumembedded/java-cef
If you look at The Minecraft launcher (the old one), look through LoginForm or LauncherFrame, you may be able to find out that method. There is a tutorial by kippykip on youtube on how to decompile and edit it: here
Related
I need to integrate a browser in a JInternalFrame. I tried a lot of different ideas:
jcef: It is based on heavyweight components an so don't work with swing
jxBrowser: is only compatible to java 8
swt Browser: works in a JFrame but not JInternalFrame, Problem is described in this question
Does someone has another Idea how to integrate a browser to swing? It should be able to show Pages, which shows webGL and compatible with java 9 and 10.
I already saw some similar questions on SO, but those are 10 years and older and don't fit for my purpose
I found a solution and it worked with The DJ Project. It contains a library, that uses the swt browser and has a API for Java Swing applications.
Is it possible to capture the screen or generate a hardcopy in GWT programatically?
using AWT its possible but the AWT can't be used in GWT[only GWT not any other like smartGWT, ext-GWT]?
On client side GWT do nothing more than Javascript. So your question is: Can I take screen shot in JavaScript? The answer is:
If you want only take screen shot inside browser and can bear different you can use html2canvas.
If you want also take screen shot out of browser, you have to use other technology such as ActiveX control (may be Java Applet with AWT).
Check this: Take a screenshot of a webpage with JavaScript?
I don't believe that you will find anything native in GWT to do this. I believe that the best that you could manage would be something like this:
http://html2canvas.hertzen.com/
GWT just compiles java into javascript as it as been said by other guys in their answer. So you can look for a solution on the client but you can also do it on the server side.
One way to make it is to use phantomJS (which is a kind of webkit on the server) to rasterize the web page into an image on the server side. Could be really usefull to create features like "Export" etc
Phantom JS scree n capture
Im trying to resolve following dilemma. I have to develop whole webpage system(with user friendly content management, it should look like very simple Drupal or Joomla) as a project to school. The webpage should have function of adding and removing articles, editing menus, editing whole webpage layout(header position, menu position etc).
Im in phase of deciding which system would be the best for this purpose. I wrote several applications in GWT. It's very quick to develop something, it works on Tomcat etc. So it could be very good adept for this task. But recently I got an idea of writing whole webpage system in JavaFX 2.0 (webpage would open inside the browser).
What is your opinion about this fact ? Should I use JavaFX or GWT? I'm not sure if whole webpage will be quick enough in JavaFX. If the users that will be visiting this page wont have problems with launching this page etc. I havent found any information about this on the internet.
Thanks for your answers :)
Go for GWT (also consider using Vaadin or SmartGWT). It does not require a Java Virtual Machine to be installed on the client. Also, GWT allows the client to download only small pieces of the application, and not the whole thing.
You cited two Content Management Systems like Drupal and Joomla that are written in PHP, so maybe the best solution for you is a CMS written in java like Alfresco or Magnolia.
do you want to do a web page or an applicatin for one plugin ? GWT of course.
GWT
GWT follows a most innovative approach: you write the entire application in Java. But it’s executed in Javascript. A good portion of your code is cross-compiled to Javascript and uploaded to the client.
Judging from the presentations I’ve seen, this approach works surprisingly good. In former times the GWT compiler used to be slow, but today, they seem to have solved (or at least alleviated) the problem. As far as I can see, GWT is an excellent choice
javafx
JavaFX 2.0 is a pretty new GUI framework. So expect a few glitches. The good news is that it’s likely to improve over the years. And I suppose people will start to write JavaFX component frameworks if JavaFX is going to be popular.
There’s a video showing the domain of JavaFX very clearly.
Container terminal monitoring with 3D JavaFX
Source
what is the current "state of art" to render a webpage in firefox into an image file (saved on disk). I want to implement something like "browsershots.org"
1.) Does firefox provide some API to interact with it?
2.) Does the new Canvas (HTML5) Element help here?
The programming language does not matter.
If you know any more information about this topic or a concrete solution, please help.
Uupdate: Yes, the Idea is to do this programatically, only using Technologies "within" Firefox. Further Ideal requirements: Multithreaded (allow rendering of several Websites in parallel on one machine)
Thanks very much, Markus
update: Yes, the Idea is to do this
programatically, only using
Technologies "within" Firefox.
See: https://developer.mozilla.org/en/Drawing_Graphics_with_Canvas#Rendering_Web_Content_Into_A_Canvas
Mozilla's canvas is extended with the
drawWindow() method. This method draws
a snapshot of the contents of a DOM
window into the canvas.
Sounds good, but note that:
This feature is only available for
code running with Chrome privileges.
It is not allowed in normal HTML
pages. Read why.
Why reinvent the wheel?
Fireshot does exactly that: https://addons.mozilla.org/en-US/firefox/addon/fireshot/
Even if you want to implement that yourself, looking at that add-on might help.
Selenium RC is a good choice.
It allows you to control Firefox (and other browsers) using Java (for instance).
For example:
http://seleniumexamples.com/blog/examples/capturing-screenshots-from-remote-selenium-rc/
I want to create an OpenOffice.org plug-in that adds a sidebar.
I have successfully installed OpenOffice.org, OpenOffice.org SDK and NetBeans OpenOffice plug-in.
I am familiar with Java, AWT and Swing, so no need to explain these concepts to me.
Now, I want to create a sidebar Panel(or JPanel) in OpenOffice.org Writer application.
How can I do this? It would be in the left and fill all available height(while using a fixed width).
Any idea on how to implement this? I have no OpenOffice.org plug-in past experience.
Thank you in advance.
This is currently not possible through the OpenOffice.org API. You can create menus, toolbars and dialogs. You cannot create dockable windows or panels via UNO. See: GUI Chapter in the Dev Guide.
Exposing this capability through the API is under active development and I suggest you join the api-dev#openoffice.org mailing list to stay on top of things.
The specific feature you asked for was already discussed there and it was suggested that it would be made available with a future update to OpenOffice 3.0. See post in the list archive.
I don't know if there's an easy answer for this. OO.o provides their dev guide here. It appears once you create an UNO component to their spec you can use:
Arbitrary objects written in Java or
C++ [and then] can be called from the user
interface, display their own GUI, and
work with the entire application.
That sounds like what you want to do. Hope this helps!
It's possible since version 4.0.
See https://wiki.openoffice.org/wiki/Sidebar