MASON-INTEREST-L Archives

February 2015

MASON-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Proportional Font
Show HTML Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Simone Gabbriellini <[log in to unmask]>
Reply To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Date:
Wed, 11 Feb 2015 17:35:26 +0100
Content-Type:
multipart/alternative
Parts/Attachments:
text/plain (1257 bytes) , text/html (2532 bytes)
Hi Sean,

thanks for the help,

First off, I'd not copy stuff from OvalPortrayal2D unless you have to.
> Just subclass your agents from OvalPortrayal2D.  Then you can say:
>
>     public final void draw(Object object, Graphics2D graphics, DrawInfo2D
> info) {
>         if (answer)
>             graphics.setColor(rightAnswer);
>         else
>             graphics.setColor(badAnswer);
>         super.draw(object, graphics, info);
>         }
>

Actually I was copying your code from antsforage, but if I do as you
suggest here, my agents don't get colored, they remains grey as default.

About the labeling, I have added these lines as suggested:
/*
 * in MyModelWithUI.java
 */
public void setupPortrayals() {
        ArgumentativeAgents af = (ArgumentativeAgents)state;
        bugPortrayal.setField(af.buggrid);
        // NEW CODE
        LabelledPortrayal2D foo = new LabelledPortrayal2D(null, "pipo");
        bugPortrayal.setPortrayalForClass(ArgumentativeAgent.class, foo);
        // END
        // reschedule the displayer
        display.reset();
        // redraw the display
        display.repaint();
    }

/*
 * In ArgumentativeAgent.java
 */
    @Override
    public String toString(){
        return String.valueOf(id);
    }

But nothing's happening... where am I wrong?

Best,
Simone


ATOM RSS1 RSS2