This is an old revision of the document!


SwingBox
Setup

Download binaries from: http://cssbox.sourceforge.net/swingbox/download.php

Include binary JAR file in the Java project's Libraries (right-click Libraries > Add Library)

Use Component
// ...
import java.awt.Dimension;
import java.io.IOException;
import java.net.URL;
 
import org.fit.cssbox.swingbox.BrowserPane;
import org.fit.cssbox.swingbox.util.GeneralEvent;
import org.fit.cssbox.swingbox.util.GeneralEventListener;
import org.fit.cssbox.swingbox.util.GeneralEvent.EventType;
import org.fit.net.DataURLHandler;
 
public class frmMain extends javax.swing.JFrame 
{
    // ...
 
    private void LaunchWebView() 
    {
        // create the component
        BrowserPane swingboxView = new BrowserPane();
        swingboxView.setMaximumSize(new Dimension(600,400));
        swingboxView.setMinimumSize(new Dimension(600,400));
        swingboxView.setPreferredSize(new Dimension(600,400));
        swingboxView.setSize(new Dimension(600,400));
 
        // add the component to your GUI
        pnlMain.add(swingboxView);  // pnlMain is a JPanel somewhere defined in the GUI
 
        // display the page
        try {
            swingboxView.setPage(new URL("https://google.com"));
        } catch(IOException exc) {
 
        }
    }
}