package core;

/*
 * Copyright (c) 2002-2007 TeamDev Ltd. All rights reserved.
 *
 * Use is subject to license terms.
 *
 * The complete licence text can be found at
 * http://www.teamdev.com/winpack/license.jsf
 */

import com.jniwrapper.win32.ie.Browser;

import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.BorderLayout;

/**
 * This sample creates browser added to a Swing container.
 *
 * @author Alexei Orischenko
 */
public class CreateBrowserSample
{
    public static void main(String[] args) throws Exception
    {
        JFrame frame = new JFrame("JExplorer - Create Browser Sample");
        frame.setSize(800, 600);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setLocationRelativeTo(null);

        Browser browser = new Browser();

        JPanel panel = new JPanel();

        // set layout
        panel.setLayout(new BorderLayout());
        panel.add(browser);

        frame.getContentPane().add(panel);


        frame.setVisible(true);

        // Wait when the browser will be ready to work
        browser.waitReady();

        browser.navigate("http://google.com");
    }
}
