importjavax.swing.SwingUtilities;
importchrriis.common.UIUtils;
importchrriis.dj.nativeswing.swtimpl.NativeInterface;
importchrriis.dj.nativeswing.swtimpl.components.JWebBrowser;
importjava.awt.*;
importjava.awt.event.WindowAdapter;
importjava.awt.event.WindowEvent;
importjavax.swing.*;
publicclassWebBrower {
/**
* @param args
*/
publicstaticvoidmain(String[] args) {
// TODO Auto-generated method stub
WebBrower webbrower=newWebBrower();
}
publicWebBrower()
{
SwingUtilities.invokeLater(newRunnable() {
publicvoidrun() {
finalJFrame frame =newJFrame("");
// frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(newEagleBrowser
("http://www.baidu.com"), BorderLayout.CENTER);
frame.setLocationByPlatform(true);
frame.setAlwaysOnTop(true);
// frame.setUndecorated(true);
frame.setSize(675,507);
// frame.setUndecorated(true);
frame.setResizable(false);
frame.addWindowListener(newWindowAdapter(){
publicvoidwindowIconified(WindowEvent e)
{
frame.setExtendedState(JFrame.ICONIFIED);
}
});
frame.setVisible(true);
}
});
NativeInterface.open();
NativeInterface.runEventPump();
}
}
classEagleBrowserextendsJPanel
{
privateJPanel webBrowserPanel;
privatechrriis.dj.nativeswing.swtimpl.components.JWebBrowser webBrowser;
privateString url;
publicEagleBrowser(String url)
{
super(newBorderLayout());
this.url = url;
webBrowserPanel =newJPanel(newBorderLayout());
webBrowser =newchrriis.dj.nativeswing.swtimpl.components.JWebBrowser();
webBrowser.navigate(url);
webBrowser.setButtonBarVisible(false);
webBrowser.setMenuBarVisible(false);
webBrowser.setBarsVisible(false);
webBrowser.setStatusBarVisible(false);
webBrowserPanel.add(webBrowser, BorderLayout.CENTER);
add(webBrowserPanel, BorderLayout.CENTER);
}
}