Monthly Archives: June 2005

Wrap JLabel Text

It took a bit of experimentation, but I think this routine could be used to allow a Java JLabel component to contained wrapped text.

This routine depends on the ability for JLabel text to contain HTML.

Basically it iterates through each word in the JLabel text, appends the word to a ‘trial’ string buffer, and determines if the trial string is larger than the JLabel’s container. If the trial string is larger, then it inserts a html break in the text, resets the trial string buffer, and moves on to the next word.

private void wrapLabelText(JLabel label, String text) {
	FontMetrics fm = label.getFontMetrics(label.getFont());
	Container container = label.getParent();
	int containerWidth = container.getWidth();

	BreakIterator boundary = BreakIterator.getWordInstance();

	StringBuffer trial = new StringBuffer();
	StringBuffer real = new StringBuffer("<html>");

	int start = boundary.first();
	for (int end =; end != BreakIterator.DONE;
		start = end, end = {
		String word = text.substring(start,end);
		int trialWidth = SwingUtilities.computeStringWidth(fm,
		if (trialWidth > containerWidth) {
			trial = new StringBuffer(word);



Google Earth

Want to know more about a specific location? Dive right in — Google Earth combines satellite imagery, maps and the power of Google Search to put the world’s geographic information at your fingertips

Google Earth

This is extraordiarily cool … even if they think that our house is about a block south of where it really is.

Zombie Dogs

U.S. scientists have managed to revive dead dogs to life, by using a technique similar to cryogenation, in which the dogs’ blood was drained and replaced by a cold, saline liquid. A couple of hours, their blood was replaced, and an electric shock brought them back to life with no brain damage. The technology will be tested on humans within the next year.

Slashdot | U.S. Scientists Create Zombie Dogs

This just gives me the hebe-jebies.

Theater Hike

We went to see a “As you like it” performed by Theater Hikes at The Morton Arboretum today.

I really wasn’t expecting much, considering the venue and price of the tickets, but I was pleasantly surprised. It was pretty good for a community theater production.

Yes, it was hot… very hot. And humid. But there was a intermittent breeze and we moved around a bit.

The production values weren’t quite on par with Broadway or even Marriott Theatre, but given the situation, it was fun to watch. Somehow I don’t think Bill Shakespeare had jeans in mind when he wrote the play.

I think we’re going to try and see “Sleepy Hollow” in September … it will be cooler then. Not sure how they are going to do the headless horseman.

Google Secrets Out

Google have recently filed a US patent which reveals a great deal of how they rank your web site. Some of it you could never of guessed at…

Great Site Ranking in Google The Secrets Out

This is a very interesting read.

I am not, as a rule, all that concerned with search engine rankings for my sites. The number of sites that cover the same topics as I do are pretty small. Thus, if someone is looking for information, chances are they will stumble across my sites.

First sign a message is spam

The first sign that a email message is spam: They assure you that it is not spam.

This is an official notification of the availability of a package deposited in your name and it is not a sales solicitation or SPAM.