[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Swarm-Support] Java Swarm With Graphs
From: |
durga bhavani |
Subject: |
Re: [Swarm-Support] Java Swarm With Graphs |
Date: |
Wed, 16 Nov 2005 14:44:38 -0800 (PST) |
Hello Marcus,
GroupModelSwarm
public Object buildObjects ()
{
super.buildObjects();
int dim=4;
int dim1=8;
worldXSize = 80;
worldYSize = 80;
world = new Grid2dImpl (getZone (), worldXSize, worldYSize);
leaderList = new LinkedList ();
leader1List = new LinkedList();
leaderList2 = new LinkedList();
world.setOverwriteWarnings(false);
SimF s;
Leader l1;
mmc = new MyMathsClass();
s = new SimF();
leaderList.add(mmc);
leaderList2.add(s);
int
x=4;
int y=4;
Graph graph = new GraphImpl (getZone ());
graph.setWindowTitle ("A Graph");
graph.pack ();
SimF()
public void Print1(){
String colors[]={"red","green","blue"};
GroupModelSwarm groupModelSwarm1;
for (int i = 1; i < 8; i++) {
//System.out.println("Creating Graph Element");
GraphElement ge = groupModelSwarm1.buildObjects().graph.createElement
();
ge.setLabel ("Time Step" + i);
ge.setWidth (2);
ge.setColor (colors[i % 3]);
System.out.println(i);
//ge.addX$Y ((5 - i) ^ 2, 1 + i);
//ge.addX$Y (i + 9, 10 * Math.sin (Math.PI * i / 10));
//System.out.println(value[k]);
int t=0;
for(int k=0;k<4;k++){
for(int l=0;l<8;l++){
ge.addX$Y(k,CL_log[k][l][t+1]);
ge.addX$Y(k+1,CL_log[k][l][t+1]);
}
t++;
}
Error : No accessible field named "graph" was found in type "java.lang.Object".
I don't why I am getting this error could you please help me
Thanks a lot
Durga
"Marcus G. Daniels" <address@hidden> wrote:
durga bhavani wrote:
> But the method where I wrote the code that method I am calling from
> ModelSwarm it does plot the Graph with the array values but it also
> creats a new graph for each iteration.
>
You'll have to move the code up to and including the `pack' of `graph'
to
buildObjects so that it will only get called once. Then make `graph'
an instance variable to be accessed by `Print1'.
_______________________________________________
Support mailing list
address@hidden
http://www.swarm.org/mailman/listinfo/support
Yahoo! FareChase - Search multiple travel sites in one click.
- [Swarm-Support] Java Swarm With Graphs, durga bhavani, 2005/11/14
- Re: [Swarm-Support] Java Swarm With Graphs, Steve Railsback, 2005/11/14
- Re: [Swarm-Support] Java Swarm With Graphs, durga bhavani, 2005/11/14
- Re: [Swarm-Support] Java Swarm With Graphs, Marcus G. Daniels, 2005/11/14
- Re: [Swarm-Support] Java Swarm With Graphs, durga bhavani, 2005/11/16
- Re: [Swarm-Support] Java Swarm With Graphs, Marcus G. Daniels, 2005/11/16
- Re: [Swarm-Support] Java Swarm With Graphs,
durga bhavani <=
- Re: [Swarm-Support] Java Swarm With Graphs, Marcus G. Daniels, 2005/11/16