Jazz API Documentation

edu.umd.cs.jazz.util
Interface ZLoadable


public interface ZLoadable

ZLoadable is an interface that defines objects 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. It adds a 'Layout' option to the menu bar, and when the 'doLayout' option is selected, it lays out all the objects in the world in an ellipse.

    import java.awt.geom.*;
    import java.awt.event.*;
    import javax.swing.*;
    
    import edu.umd.cs.jazz.*;
    import edu.umd.cs.jazz.util.*;
    
    public class Foo implements Runnable, ZLoadable {
        JMenuBar menubar = null;
        ZCamera camera = null;
        ZDrawingSurface surface = null;
        ZLayerGroup layer = null;
        ZLayoutGroup layoutGroup = null;
        
        public Foo() {
        }
        
        public void run() {
    	JMenu layoutMenu = new JMenu("Layout");
    	JMenuItem menuItem = new JMenuItem("doLayout");
    	menuItem.addActionListener(new ActionListener() {
    	    public void actionPerformed(ActionEvent e) {
    				// Make a new layout group with a path layout manager
    		layoutGroup = new ZLayoutGroup();
    		ZPathLayoutManager layout = new ZPathLayoutManager();
    		layout.setShape(new Ellipse2D.Float(0, 0, 200, 200));
    		
    				// Move all the scene's nodes under the layout group and lay them out
    		ZNode[] children = layer.getChildren();
    		for (int i=0; i


Method Summary
 void setCamera(ZCamera camera)
           
 void setDrawingSurface(ZDrawingSurface surface)
           
 void setLayer(ZLayerGroup layer)
           
 void setMenubar(javax.swing.JMenuBar menubar)
           
 

Method Detail

setMenubar

public void setMenubar(javax.swing.JMenuBar menubar)

setCamera

public void setCamera(ZCamera camera)

setDrawingSurface

public void setDrawingSurface(ZDrawingSurface surface)

setLayer

public void setLayer(ZLayerGroup layer)

Jazz API Documentation