★ wanayoo — archive 1999 http://developer.java.sun.com/developer/technicalArticles/Interviews/InteractiveJava/index.htmlNouvelle recherche | Portail wanayoo
Java Technology Home Page
A-Z Index

Java Developer Connection(SM)
Technical Articles

Downloads, APIs, Documentation
Java Developer Connection
Tutorials, Tech Articles, Training
Online Support
Community Discussion
News & Events from Everywhere
Products from Everywhere
How Java Technology is Used Worldwide
 
Articles Index

Of Poets and Interactive Java
Ian McFarland Shares His Multimedia Techniques

John Papageorge

Computer scientists and other purists often praise the beauty of Java as a language, but in San Francisco, people value it because it brings artists and audiences together in a way that may someday eliminate the middlemen.

"With Java, you've got a broader range of expression and interactivity," remarks producer and director George Coates," he explains. "Java lets you put an audience into your theater in the way they might experience it when they come. I think Bass and Ticketron will soon become irrelevant."

For Coates' most recent production, "20/20 Blake," programmer Ian McFarland created a Java-based interactive dish called "Make-a-Blake." "It's a toy for compositing different images from William Blake paintings into your own version," he says. Java allowed audiences to manipulate the artist's paintings by changing objects, characters, and backdrop color. The bottom line: "Our ticket sales went up after `Make-a-Blake' was introduced," says Coates.

McFarland, the man behind Coates' Java magic, is no stranger to the technical and artistic world of San Francisco. Nineteen years ago, Java expert Ian McFarland embraced the art of programming in one of these classes. Since his childhood days of playing with advanced BASIC, McFarland has made a name for himself as a programmer, especially in his creative use of Java.

He's worked with Ted Nelson, known as the father of hypertext, on a project that was a precursor to the World Wide Web. "Xanadu was a world-wide distributed document system that included a more advanced feature set than the Web except it was a closed system," McFarland explains.

McFarland helped launch HotWired and went on to form his own web publishing company called Neo Communication. But it was Bay Area-based multimedia impresario George Coates who got the programmer involved in Java. "A couple of years ago, Coates was asked to put on a presentation at a Sun conference to show all the cool things that this brand new language Java could do," he recalls.

"Coates, programmer Aaron Alpar, and I designed a Java-based seating reservation server in which people could reserve tickets in advance, and the virtual theater displayed who had seats for the show. When people logged in, the applet became active, and users could click on any seats they wanted. Empty seats were in gray, and once reserved, would turn red."

How did the Make-a-Blake work?

McFarland designed the component to have background, foreground, and character layers. In addition, he aimed to encapsulate it. The next step was to design the API for the component. To allow the background, foreground, and character images to pass from another component, he had the x and y position automatically reset.

"Because Java has the color model that it does, color is represented as red, green, and blue, and there are always eight bits of alpha," explains McFarland. The alpha is used for transparency, so you could composite things on top of each other. We used alpha to make our images transparent around the edges. I also drew the background and foreground with alpha, so when you move an object, it moves smoothly."

Another Java technique McFarland used to design the Make-a-Blake was double buffering. "What you do is override the update method; it erases your component and then it passes the graphics object to the paint method on the applet. What that means is every time the update method is called, your applet flickers, because these things need to be repainted from scratch. Don't have it repaint the panel; instead, use your off-screen buffer and copy the bits over. It paints all at once, and it gives the illusion of the pixels moving, instead of redrawing everything one thing at a time."

Make-a-Blake also featured a tab panel with components that work like simple buttons. "We wanted to have a tab panel at the bottom to give the user immediate access to all the controls," McFarland explains. "More responsive UI is one of the big advantages Java gives you, and we wanted to make the most of it."

The first step in creating the tab panel was deciding what tasks to put on each tab card. McFarland decided to put instructions on the first one, and then groups of images on different layers for the other ones.

"There are two approaches to doing a tab card layout," McFarland explains. "The first way is having card objects that have tabs on them, which is harder to program; the second way, and the way we did it, is to make tab objects that control the card layout. And it works functionally as if you had a bunch of button objects," he continues. "The result: The actual creation of the tab object is very simple," he says, and as he puts it, "It's usually a good sign if you can achieve your goals simply."


[ This page was updated: 28-Sep-99 ]

Products & APIs | Developer Connection | Docs & Training | Online Support
Community Discussion | Industry News | Solutions Marketplace | Case Studies
Glossary - Applets - Tutorial - Employment - Business & Licensing - Java Store - Java in the Real World
FAQ | Feedback | Map | A-Z Index
For more information on Java technology
and other software from Sun Microsystems, call:
(800) 786-7638
Outside the U.S. and Canada, dial your country's AT&T Direct Access Number first.
Sun Microsystems, Inc.
Copyright © 1995-99 Sun Microsystems, Inc.
All Rights Reserved. Legal Terms. Privacy Policy.