Issue with WebBrowserComponent and native title bars

At least on Windows, I've discovered that calling setUsingNativeTitleBar (true) immediately after DocumentWindow construction can cause issues for any WebBrowserComponents that have been added as a child. The browser remains black and doesn't respond to any goToUrl() calls. So for the benefit of anyone else who might come across this issue, here are some workarounds:

  • Call setUsingNativeTitleBar (true) in your DocumentWindow constructor before adding the WebBrowserComponent to your owned content component
    • In my case the DocumentWindow has a dark background and I always get a white box that briefly appears during app startup and I just can't stand it!
    • If you have a white background this might not bother you
  • Use a timer to delay the addition of the WebBrowserComponent
  • Override lookAndFeelChanged() in your owned content component and add the WebBrowserComponent from there
    • If you set the default look and feel before constructing your DocumentWindow, then the first call to lookAndFeelChanged should be triggered as a consequence of enabling native title bars