Submitted by chuidiang on Fri, 10/15/2010 - 13:49
Posted in
Para mostrar un texto html en java, el componente adecuado es JEditorPane. El siguiente ejemplo de código muestra cómo hacerlo
JFrame f = new JFrame();
JEditorPane editor = new JEditorPane();editor.setContentType("text/html");editor.setText("<html><head></<head><body><h1>titulo</h1><p>hola <b>negrita</b></p></body></html>");
f.getContentPane().add(editor);f.pack();f.setVisible(true);
- chuidiang's blog
- Login to post comments
