private void showEmbedded(String applicationUrl) {
final EmbeddedBrowser browser = new EmbeddedBrowser();
browser.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
int value = JOptionPane.showConfirmDialog(browser, "Are you sure you want to exit?", appName, JOptionPane.YES_NO_OPTION);
if (value == JOptionPane.YES_OPTION) {
browser.dispose();
EventBus.publish(new ExitApplicationMessage() );
}
}
});
browser.setVisible(true);
if (appIcon != null) browser.setIconImage(appIcon.getImage());
browser.setTitle(appName);
browser.setExtendedState(JFrame.MAXIMIZED_BOTH);
try {
// have some delay before showing? Maybe not init'ed
Thread.sleep(400);
} catch (InterruptedException ex) {
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
}
browser.setUrl(applicationUrl);
browser.invalidate();
browser.validate();
browser.repaint();
}