You can edit almost every page by Creating an account. Otherwise, see the FAQ.

JxBrowser

From EverybodyWiki Bios & Wiki

Script error: No such module "AfC submission catcheck".

JxBrowser
Developer(s)TeamDev
Initial release23 March, 2007
Stable release
7.16 / 9 June, 2021
Written inJava, C++, Objective C
Engine
    Operating systemmacOS, Windows and Linux
    PlatformIA-32, x86-64, ARM
    TypeJava library
    LicenseTeamDev[1]
    Websitehttps://www.teamdev.com/jxbrowser

    Search JxBrowser on Amazon.

    JxBrowser is a proprietary Java library that allows integrating Chromium web browser component into Java Swing, AWT, or JavaFX/SWT desktop applications.

    Main features[edit]

    Here's a list of the main features:

    • Embed a visual Swing, JavaFX, or SWT control into Java desktop application to display HTML content of a web page
    • Load web pages, local HTML files, PDF documents
    • Access DOM, execute JavaScript, call Java from JavaScript
    • Print web pages or save them as PDF documents
    • Intercept the network requests and listen to the navigation events
    • Access Chromium functionality such as cookies, media, plugins, cache, proxy, spell checking, authentication, DevTools, etc.
    • Convert HTML to PNG or JPEG

    Architecture[edit]

    The architecture of the library consists of the multiple processes such as Java application process and different Chromium processes:

    Architecture of JxBrowser library
    JxBrowser Architecture

    Communication between different processes is done via Inter-process Communication (IPC). IPC transfers data between two processes on a local machine.

    To transfer data between Java and Chromium processes the library uses its own IPC implementation based on sockets and shared memory. Communication between Chromium processes is done via Chromium IPC[2] implementation.

    Example[edit]

    Java Swing[edit]

    import static com.teamdev.jxbrowser.engine.RenderingMode.HARDWARE_ACCELERATED;
    
    import com.teamdev.jxbrowser.browser.Browser;
    import com.teamdev.jxbrowser.engine.Engine;
    import com.teamdev.jxbrowser.view.swing.BrowserView;
    import java.awt.BorderLayout;
    import javax.swing.JFrame;
    import javax.swing.SwingUtilities;
    
    /**
     * This example demonstrates how to create and initialize the Engine,
     * create the Browser, embed it into a Swing container, display it in
     * JFrame, and load https://google.com
     */
    public final class HelloWorld {
    
        public static void main(String[] args) {
            Engine engine = Engine.newInstance(HARDWARE_ACCELERATED);
            Browser browser = engine.newBrowser();
    
            SwingUtilities.invokeLater(() -> {
                BrowserView view = BrowserView.newInstance(browser);
    
                JFrame frame = new JFrame("Swing BrowserView");
                frame.add(view, BorderLayout.CENTER);
                frame.setSize(700, 500);
                frame.setVisible(true);
    
                browser.navigation().loadUrl("https://google.com");
            });
        }
    }
    

    JavaFX[edit]

    import static com.teamdev.jxbrowser.engine.RenderingMode.HARDWARE_ACCELERATED;
    
    import com.teamdev.jxbrowser.browser.Browser;
    import com.teamdev.jxbrowser.engine.Engine;
    import com.teamdev.jxbrowser.view.javafx.BrowserView;
    import javafx.application.Application;
    import javafx.scene.Scene;
    import javafx.scene.layout.BorderPane;
    import javafx.stage.Stage;
    
    /**
     * This example demonstrates how to create and initialize the Engine,
     * create the Browser, embed it into a JavaFX scene, and load https://google.com
     */
    public final class HelloWorld extends Application {
    
        @Override
        public void start(Stage primaryStage) {
            Engine engine = Engine.newInstance(HARDWARE_ACCELERATED);
            Browser browser = engine.newBrowser();
            BrowserView view = BrowserView.newInstance(browser);
    
            Scene scene = new Scene(new BorderPane(view), 700, 500);
            primaryStage.setTitle("JavaFX BrowserView");
            primaryStage.setScene(scene);
            primaryStage.show();
    
            browser.navigation().loadUrl("https://google.com");
        }
    }
    

    SWT[edit]

    import static com.teamdev.jxbrowser.engine.RenderingMode.HARDWARE_ACCELERATED;
    
    import com.teamdev.jxbrowser.browser.Browser;
    import com.teamdev.jxbrowser.engine.Engine;
    import com.teamdev.jxbrowser.view.swt.BrowserView;
    import org.eclipse.swt.layout.FillLayout;
    import org.eclipse.swt.widgets.Display;
    import org.eclipse.swt.widgets.Shell;
    
    /**
     * This example demonstrates how to create and initialize
     * the Engine, create the Browser, embed it into an SWT Shell,
     * and load https://google.com
     */
    public final class HelloWorld {
    
        public static void main(String[] args) {
            Engine engine = Engine.newInstance(HARDWARE_ACCELERATED);
            Browser browser = engine.newBrowser();
    
            Display display = new Display();
            Shell shell = new Shell(display);
            shell.setText("SWT BrowserView");
            shell.setLayout(new FillLayout());
    
            BrowserView view = BrowserView.newInstance(shell, browser);
            view.setSize(700, 500);
    
            shell.pack();
            shell.open();
    
            browser.navigation().loadUrl("https://google.com");
    
            while (!shell.isDisposed()) {
                if (!display.readAndDispatch()) {
                    display.sleep();
                }
            }
            engine.close();
            display.dispose();
        }
    }
    

    History[edit]

    JxBrowser 1.0 was released on April 11, 2008 and supported Windows, macOS, and Linux. It was based on Mozilla Firefox (XULRunner).

    In December 18, 2009 JxBrowser 2.0 was released. The main feature in this release was support of different web browser engines on different platforms. The library integrated with the installed in the operating system Apple Safari (WebKit) on macOS, on Windows — MS Internet Explorer, on Linux, Windows, and macOS the library integrated with the built-in Mozilla Firefox (XULRunner) engine.

    JxBrowser 4.0 was released on June 7, 2013. Since this version the library is based on Chromium.

    See also[edit]

    References[edit]

    1. "JxBrowser Product Licence Agreement". TeamDev. TeamDev. Retrieved 2 February 2016.
    2. "Chromium IPC". Retrieved 2021-05-14.



    This article "JxBrowser" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:JxBrowser. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.