PDA

Click to See Complete Forum and Search --> : What You've Been Waiting For...Browser/URL/Frame/Rendering


Dec 14th, 2000, 03:11 PM
This should get us all started with rendering html in a frame. I think it complies with at least HTML 3.2. However I noticed that the links aren't "active". There is also a class javax.swing.text.html.parser.Parser that I'm guessing might help with making a link "active" (which probably means adding a listener to specific text). Not as sweet as what I've seen in a VB control. I know several of us were looking for such a 'code fragment'. ;)


//Surf.java
import java.awt.*;
import java.io.*;
import javax.swing.*;

public class Surf extends Frame{
public Surf(){
try {
JEditorPane jed = new JEditorPane("http://www.VirtuallyGlobal.org");
jed.setEditable(false);//Attempt to activate hyperlinks?
jed.addHyperlinkListener(new Hyperactive());//Attempt to activate hyperlinks?
add(jed);
setSize(600,600);
show();
} catch (IOException e) {
System.err.println(e);
}
}

public static void main(String[] args){
new Surf();
}
}


The Activation of HyperLinks needs "massaging". Check out the "class Hyperactive implements HyperlinkListener {" at the API for javax.swing.JEditorPane.

[Edited by VirtuallyVB on 12-14-2000 at 04:58 PM]