Using HTML in Swing components with Linux
Ok this is really strange, none of the html tags seem to work under my
linux machine and it's running java version 1.4.2... they should work, I know I should upgrade to 1.6 but that's not the point.
Here's a simple example, all I get is the JLabel with all the html
showing as regular text.
Any suggestions? Does anyone else using linux get this?
import javax.swing.*;
publicclass Randomextends JFrame{
publicvoid loadFrame(){
JLabel label =new JLabel("<html><b>Test</b></html>");
this.getContentPane().add(label);
this.setSize(400,400);
this.show();
}
public Random(){
loadFrame();
}
publicstaticvoid main(String args[]){
new Random();
}
}
[1428 byte] By [
anijapa] at [2007-10-3 3:29:25]

Ok I solved it.
Turns out that the java version that Ubuntu installed by default has to have something missing, because I replaced it with the Mustang JDK I downloaded from the Sun website and everything works peachy.
In fact, if I run the same code with the java I had installed by default, here's what I get (it runs just fine now that I installed mustang from the SUN website)
createDefaultRoot not implemented
fireChangedUpdate not implemented
createBranchElement not implemented
Exception in thread "main" java.lang.NullPointerException: This BranchElement has no children.
at javax.swing.text.AbstractDocument$BranchElement.getStartOffset(libgcj.so.7)
at javax.swing.text.AbstractDocument$BranchElement.getElementIndex(libgcj.so.7)
at javax.swing.text.DefaultStyledDocument$ElementBuffer.insertParagraph(libgcj.so.7)
at javax.swing.text.DefaultStyledDocument$ElementBuffer.insertUpdate(libgcj.so.7)
at javax.swing.text.DefaultStyledDocument$ElementBuffer.insert(libgcj.so.7)
at javax.swing.text.DefaultStyledDocument.insert(libgcj.so.7)
at javax.swing.text.html.HTMLDocument.insert(libgcj.so.7)
at javax.swing.text.html.HTMLDocument$HTMLReader.flush(libgcj.so.7)
at javax.swing.text.html.parser.ParserDelegator.parse(libgcj.so.7)
at javax.swing.text.html.HTMLEditorKit.read(libgcj.so.7)
at javax.swing.JEditorPane.setText(libgcj.so.7)
at Random.loadFrame(Random.java:8)
at Random.<init>(Random.java:15)
at Random.main(Random.java:19)