The example below demonstrates how to embed Swing BrowserView into JTabbedPane. The BrowserView can be embedded into JTabbedPane in both rendering modes: lightweight and heavyweight. In this example the default (heavyweight) rendering mode is used.(下面的示例演示如何将Swing BrowserView嵌入到JTabbedPane中。 BrowserView可以以两种渲染模式嵌入到JTabbedPane中:轻量级和重量级。在此示例中,使用默认(重量级)渲染模式。)

import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.swing.BrowserView;

import javax.swing.*;
import java.awt.*;

 * The sample demonstrates how to use Browser in JTabbedPane.
public class TabbedPaneSample {
    public static void main(String[] args) {
        Browser browserOne = new Browser();
        Browser browserTwo = new Browser();

        JTabbedPane tabbedPane = new JTabbedPane();
        tabbedPane.addTab("Browser One", new BrowserView(browserOne));
        tabbedPane.addTab("Browser Two", new BrowserView(browserTwo));

        JFrame frame = new JFrame();
        frame.getContentPane().add(tabbedPane, BorderLayout.CENTER);
        frame.setSize(800, 600);