I added a WebPage to my JFrame when we press a button (webpage opens in same Frame). It works fine. But I would like to add a scrollPane to it, but when I add the JScrollPane jsp = new JScrollPane(jep);
(jep = JEditorPane) the webpage just won't show up.
I will add more info to this page if needed.
Code (main part)
JEditorPane jep = new JEditorPane();
jep.setEditable(false);
try {
jep.setPage("xxxxxxxxxxxxx");
} catch (IOException error) {
jep.setContentType("text/html");
}
jep.setBounds(100, 50, 150, 100);
JScrollPane jsp = new JScrollPane(jep);
add(jsp)
add(jep);
Thanks, ~3751_Creator
The reason is this Line:
jep.setBounds(100, 50, 150, 100);
You have set the bounds for JEditorPane
but now you have added that JEditorPane
to the JScrollPane
. So instead of setting bounds for JEditorPane
you should have use setbounds
for JScrollPane
.