so I've searched up on this How do I put html in a JLabel in java?, and so far I've come up with this:
String labelText ="<html><FONT COLOR=RED>Red</FONT> and <FONT COLOR=BLUE>Blue</FONT> Text</html>";
JLabel coloredLabel =new JLabel(labelText);
note that i did not make this code, this was an answer off that question.
So far that's good, but how would i take it off the website and into that?
I've go this:
JLabel res;
res = new JLabel("<html>" + the code i got from the internet using JauntApi + "</html>");
panel.add(res);
so far, nothing is showing, which makes me think (and is kind of obvious) that i did something wrong. But yet, when i do this:
System.out.println(code from internet);
It works perfectly fine and prints out the html.
So, my problem is: how do i take the html and put it on that JPanel? Thanks, and sorry for not being very clear; I suck at explaining.
Note that i want it to look like the actual website, not just a bunch of html tags.
My whole code?
public static void main(String[] args){
final JFrame frame = new JFrame("MobaGuideLOL");
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setBounds(200, 200, 600, 600);
JPanel panel = new JPanel();
frame.add(panel);
JLabel res;
try{
UserAgent userAgent = new UserAgent();
userAgent.visit("http://www.mobafire.com/league-of-legends/ahri-guide");
System.out.println(userAgent.doc.innerHTML());
res = new JLabel("<html>" + userAgent.doc.innerHTML() + "</html>");
panel.add(res);
}catch(JauntException e){
System.err.println(e);
}
}
it's a guide for league of legends just saying