newWebBrowser.setButtonBarVisible((Boolean)args[2]);
newWebBrowser.setLocationBarVisible((Boolean)args[3]);
newWebBrowser.setStatusBarVisible((Boolean)args[4]);
Point location = (Point)args[5];
Dimension size = (Dimension)args[6];
JWebBrowserWindow browserWindow = newWebBrowser.getWebBrowserWindow();
if(browserWindow != null) {
if(size != null) {
((Window)browserWindow).validate();
Dimension windowSize = browserWindow.getSize();
Dimension webBrowserSize = ((NativeWebBrowser)browserWindow.getWebBrowser().getNativeComponent()).embeddableComponent.getSize();
if(size.width > 0) {
windowSize.width -= webBrowserSize.width;
windowSize.width += size.width;
}
if(size.height > 0) {
windowSize.height -= webBrowserSize.height;
windowSize.height += size.height;
}
browserWindow.setSize(windowSize);
}
if(location != null) {
browserWindow.setLocation(location);
}
}
Object[] listeners = nativeWebBrowser.listenerList.getListenerList();
WebBrowserWindowOpeningEvent e = null;
for(int i=listeners.length-2; i>=0 && newWebBrowser != null; i-=2) {
if(listeners[i] == WebBrowserListener.class) {
if(e == null) {
e = new WebBrowserWindowOpeningEvent(webBrowser, newWebBrowser, location, size);
}
((WebBrowserListener)listeners[i + 1]).windowOpening(e);
}
}
new Thread() {
@Override
public void run() {
try {
sleep(600);
} catch(Exception e) {
}
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JWebBrowserWindow browserWindow = newWebBrowser.getWebBrowserWindow();
if(browserWindow != null && !newWebBrowser.getNativeComponent().isNativePeerDisposed()) {
browserWindow.setVisible(true);
}
}
});
}
}.start();