In order to support oAuth 2 in my Swing application, I need to load a web page URL supplied by Google. Since JavaFX has a better web support, I decide to use the source code from http://docs.oracle.com/javafx/2/swing/SimpleSwingBrowser.java.htm
SwingUtilities.invokeLater(new Runnable() {
public void run() {
SimpleSwingBrowser browser = new SimpleSwingBrowser();
browser.setVisible(true);
browser.loadURL(googleUrl);
}
});
Since the code example provided by Oracle doesn't come with "auto-fit web page" feature, I will be getting a display something like
The closest example is http://java-no-makanaikata.blogspot.com/2012/10/javafx-webview-size-trick.html. However, the example requires us to inject our custom <div>
tag into WebView
's content, which is not something I wish to do. I prefer to HTML content loading, all done by `WebView.