/*
MGD swarm-support 
        mgd@swarm.org (Marcus G. Daniels)     03/12/2001

I just went over tkobjc and tightened-up the gui/
interfaces to be less icky in Java (maily removing implicit object
returns).  Graph, GraphElement, Histogram, Pixmap, and some Canvas
things are now accessible in Java.  FunctionGraph is still not back
because it uses by-pointer-reference returns.  But if someone would like
to restructure the FunctionGraph API to work without pointers (its
just basically one method), I'll add it to the Java API.

This stuff is in today's .DLLs/.jar
(ftp://ftp.swarm.org/pub/swarm/binaries/w32/latest), and source
snapshot (ftp://ftp.swarm.org/pub/swarm/src/testing).

So, here's a demo of usage of Graph (not EZGraph) and a demo of a Swarm
Canvas (not AWT/Swing).

*/

import swarm.Globals;
import swarm.simtoolsgui.GUISwarmImpl;
import swarm.defobj.Zone;
import swarm.gui.Graph;
import swarm.gui.GraphElement;
import swarm.gui.GraphImpl;
import swarm.Selector;

public class TestGraph extends GUISwarmImpl {
    TestGraph (Zone aZone) {
        super (aZone);
    }

    public Object buildObjects () {
        super.buildObjects ();

        Graph graph = new GraphImpl (getZone ());

        graph.setWindowTitle ("My Graph");
        graph.pack ();
        
        GraphElement ge = graph.createElement ();
        
        ge.setLabel ("myLabel");
        ge.setColor ("red");
        ge.setWidth (1);

        ge.addX$Y (1, 1);
        ge.addX$Y (10, 10);
        ge.addX$Y (10, 5);

        return this;
    }

    static void main (String []args) {
        Globals.env.initSwarm ("TestGraph", "0.0", "bug-swarm@swarm.org",
                               args);
        TestGraph testGraph = new TestGraph (Globals.env.globalZone);

        testGraph.buildObjects ();
        testGraph.buildActions ();
        testGraph.activateIn (null);
        testGraph.go ();
    }
}
import swarm.Globals;
import swarm.simtoolsgui.GUISwarmImpl;
import swarm.defobj.Zone;
import swarm.gui.Graph;
import swarm.gui.GraphElement;
import swarm.gui.GraphImpl;
import swarm.Selector;

public class TestGraph extends GUISwarmImpl {
    TestGraph (Zone aZone) {
        super (aZone);
    }

    public Object buildObjects () {
        super.buildObjects ();

        Graph graph = new GraphImpl (getZone ());

        graph.setWindowTitle ("My Graph");
        graph.pack ();
        
        GraphElement ge = graph.createElement ();
        
        ge.setLabel ("myLabel");
        ge.setColor ("red");
        ge.setWidth (1);

        ge.addX$Y (1, 1);
        ge.addX$Y (10, 10);
        ge.addX$Y (10, 5);

        return this;
    }

    static void main (String []args) {
        Globals.env.initSwarm ("TestGraph", "0.0", "bug-swarm@swarm.org",
                               args);
        TestGraph testGraph = new TestGraph (Globals.env.globalZone);

        testGraph.buildObjects ();
        testGraph.buildActions ();
        testGraph.activateIn (null);
        testGraph.go ();
    }
}

