edu.umd.cs.jazz.util
Interface ZLoadable
- public abstract interface ZLoadable
A ZLoadable object is one that can be dynamically loaded into Jazz, and be
made aware of the basic scenegraph structure so that it can add itself
to the application and do something useful. When a ZLoadable object
is loaded into Jazz, all these methods are guaranteed to be called which
specify the primary menubar of the application, and the basic elements
of the scenegraph (camera, surface, and top node).
The following code is a sample stand-alone code segment that implements
ZLoadable and can be imported directly into the demo HiNote program.
import java.awt.geom.*;
import java.awt.event.*;
import javax.swing.*;
import edu.umd.cs.jazz.scenegraph.*;
import edu.umd.cs.jazz.util.*;
public class PathTest implements Runnable, ZLoadable {
JMenuBar menubar = null;
ZCamera camera = null;
ZSurface surface = null;
ZNode layer = null;
public PathTest() {
}
public void run() {
ZPathLayoutManager layout = new ZPathLayoutManager();
layout.setShape(new Ellipse2D.Float(0, 0, 200, 200));
layer.setLayoutManager(layout);
JMenu layoutMenu = new JMenu("Layout");
JMenuItem menuItem = new JMenuItem("doLayout");
menuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
layer.doLayout();
surface.restore();
}
});
layoutMenu.add(menuItem);
menubar.add(layoutMenu);
menubar.revalidate();
}
public void setMenubar(JMenuBar aMenubar) {
menubar = aMenubar;
}
public void setCamera(ZCamera aCamera) {
camera = aCamera;
}
public void setSurface(ZSurface aSurface) {
surface = aSurface;
}
public void setLayer(ZNode aLayer) {
layer = aLayer;
}
}
setMenubar
public void setMenubar(javax.swing.JMenuBar menubar)
setCamera
public void setCamera(ZCamera camera)
setSurface
public void setSurface(ZSurface surface)
setLayer
public void setLayer(ZNode layer)