JBCefBrowser, how to properly set HTML string
Answered
In my plugin I have HTML I need to display to my user, which I have as just a String of HTML. I'm trying to use the JBCefBrowser with the following code:
JBCefBrowser myBrowser = new JBCefBrowser();
myBrowser.loadHTML("<html><body>Hello World</body></html>");
myBrowser.openDevtools();
The window will open, but its contents are always blank:
What am I doing wrong?
Please sign in to leave a comment.
Please show more context of your code and specify what IDE version/JBR you're using. Ideally link to your plugin sources to reproduce.
Hi Yann! You beat me to it, was about to reply! My problem was just not fully understanding how to use this component. I have it working now with this code:
Where "html" is a string of HTML getting passed to my method, and "htmlPanel" is a JPanel.
Ran into a similar issue, and found that using BorderLayout made it work for me.
Brandon Atkinson
Sorry to bother you, but I came across the same problem. I tried to new a JPanel like this:
But there was nothing to display. And there was no error created.
Bing you don't specify BorderLayout in JPanel constructor call
Yann Cebron
It still does not work to add BoderLayout