[thelist] java and html

Peter Barrett peterb at corel.com
Mon Feb 12 09:47:59 CST 2001

Sorry to be so late in the reply to this one...
<amazement>I actually didn't have to work last weekend!</amazement>

Algian wrote:

> hello evolters,
> I've been trying to make an applet which has an area
> in which it can display posts that people leave, with an icon
> beside their post and lines separating each post like an html <hr>
> tag does

Personally, I'd make a little post class or something that extends panel.
Then you can use a simple flow layout to have an icon on the left and a text
label on the right. Set the width of the panel such that only one will fit in
your applet, width-wise. Then, use another flow layout in the main applet,
for all of those panels,and all of your posts will display vertically. You
can play with the size of the post panels to get the spacing between them the
way you like.

> also are links do-able in an applet like anchors?.....

afaik, if you want it to LOOK like an html link, you'll need to make another
little class, which has a String and a URL link(see below), and a static
boolean (to know if it's been clicked before or not), draws itself with an
underline (in fresh, or visited colors of choice), and uses
AppletContext.showDocument(URL) to actually change the page. Then, you can
implement the mouse handlers for the class to call the showDocument (the
specific mouse handlers depend on what version of java you're using).

> Also the image needs to be loaded from a url...is that do-able?

import java.net.*;
String s = "http://foo.com/images/so_cool.gif"
URL u = null;
    u = new URL(s);
}catch(MalformedURLException e){
    System.out.println("Malformed URL  " + s + ": " + e);

> Thanks a ton


More information about the thelist mailing list