Inspiration comes from all kinds of places. The latest module in the Project Wonderland Module Warehouse was inspired by two events: Jordan’s tooltip component and the +Spaces EU Project.
If you’ve been following the news on the Project Wonderland web site, you’ll have seen an announcement of the +Spaces (“Positive Spaces”) EU project. One of the goals of the project is to enable interoperability between Project Wonderland and OpenSim. I’m not a big Second Life user and I’ve never used OpenSim, so I thought it was time to take a look at how to develop for OpenSim. As with most developer introductions, OpenSim offers a nice “Hello World!” example–which led me to wonder how hard it would be to easily add text to a Project Wonderland world.
At about the same time, Jordan released his tooltip component and it struck me that it would be cool if it was a proper object, not just a component. Of course, one of the benefits of developing in Java is that you get access to millions of lines of Java code and libraries that you can incorporate into your software. So it is with Jordan’s tooltip–it uses a Swing JLabel that can incorporate HTML.
So, how about a Hello World example for Project Wonderland? Easy… just download the Poster module from the Warehouse. Once installed, you can select “Poster” from the Insert Object dialogue to get a Hell0 World poster.
To edit the text, right click on the poster and select “Set Text…” from the context menu. Enter the text in the text area of the dialogue box. You can preview the text (by clicking the Preview button) and accept it by clicking the OK button. The dialogue box also enables you to set your poster to be a “Billboard” (always orients towards the camera). Like the Tooltip component, the Poster uses a Swing JLabel to render the text, so you can enter HTML in the text area. For example:
When you click OK, this will update the Poster as illustrated below:
You can use more or less any HTML, but there are a few restrictions due to Swing. So, now you’ve got an object into which you can write any text, or insert anything that can be rendered via HTML. But there’s more… because it’s a first-class object in Project Wonderland it can also have capabilities applied to it. For example, a clickable-link, or audio.



Cool!!!
This is definitely great! (The other comment already said it so succinctly.)
I love it!
And it’s *so* much more versatile than SL-style hovertext.
I hope the +Spaces people are in contact with the Architecture Working Group/VWRAP folks; if not I can arrange introductions.
Does the actually scale the img in Swing?
I didn’t think Swing was that smart, and I can’t get that to work in a mockup.
Oh, poo.
I typed an img tag and of course it disappeared. Just does img style=”width:nnn height:mmm;” actually scale the image to match the style in Swing?
Maggie
you’re right, Swing seems to ignore the style dimensions. How annoying!
The Swing HTML renderer seems to treat IMG as an empty tag:
http://java.sun.com/products/jfc/tsc/articles/bookmarks/
Bernard
Kudos for finding any docs on what HTML Swing actually does support. Although “empty tag” doesn’t mean “no attributes” in this context.
We don’t a full HTML renderer in Swing (although that would sure be nice!), and scaling of IMGs would be a luxury. But often it’s hard to know what HTMLage is actually going to be noticed by Swing.
My experience has been that in the absence of strict specs, experimentation is the only way to find out. I often use the Beanshell frame() method for those experiments, right out of the jEdit Beanshell console.
No reason I can think of not to do that in-world right on a Poster object, though.
And this is why I love http://www.virtualnorthstar.com. Stunning posts.
[...] Poster [...]