LISTSERV mailing list manager LISTSERV 16.0

Help for MASON-INTEREST-L Archives


MASON-INTEREST-L Archives

MASON-INTEREST-L Archives


MASON-INTEREST-L@LISTSERV.GMU.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

MASON-INTEREST-L Home

MASON-INTEREST-L Home

MASON-INTEREST-L  February 2008

MASON-INTEREST-L February 2008

Subject:

Re: Some More Followup, Re: Using only Display

From:

Siamak Sarmady <[log in to unmask]>

Reply-To:

MASON Multiagent Simulation Toolkit <[log in to unmask]>

Date:

Sat, 23 Feb 2008 18:30:33 +0800

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (124 lines)

Great! I was trying to do this in recent few days.

Actually the output window is very useful (snap shot, video, zoom,...)
. In addition to using Mason itself for Multi-Agent simulation, I use
the window for my analyzer tool.

The fact that Mason is light weight (in comparison to other
libraries/tool boxes I have used before) and the design (separate
sections) make it very useful for big simulations. I have had up to
100,000 pedestrians (with



On Thu, Feb 21, 2008 at 5:53 AM, Sean Luke <[log in to unmask]> wrote:
> Siamak asked how one might go about displaying only a Display2D.
>  I've been fooling around a little bit to put together a bit of code
>  explaining this.
>
>  Before I go on, here are some very slightly revised files for
>  Display2D and Display3D which I'll commit to CVS when I am able (I'm
>  typing this on the plane :-) ...
>
>
>
>
>  The first step is to start the Console by yourself, rather than
>  having the user do it.  This is easy: you just call Console.pressPlay
>  ().  For example, in the main() method of HeatBugsWithUI, you could
>  do this:
>
>      public static void main(String[] args)
>          {
>          HeatBugsWithSimpleUI heatbugs = new HeatBugsWithSimpleUI();
>          Console c = new Console(heatbugs);
>         c.pressPlay();
>         }
>
>  The second step is to hide the Console.  There are two parts to
>  this.  First, you keep it from showing up in the first place, and
>  second, you remove the menu option on the Display2D or Display3D
>  which pops it up later.  To keep it from showing in the first place,
>  just don't call Console.setVisible() in your main method.  In the
>  main method above, notice that it's not called.  To eliminate the
>  menu, I have a simple hack: you'll need to prevent Display2D and
>  Display3D's createConsoleMenu() from doing anything when called.  For
>  example, in HeatBugsWithUI's init() method, you change
>
>         display = new Display2D(400,400,this,1)
>
>  to...
>
>         display = new Display2D(400,400,this,1)
>             {
>             public void createConsoleMenu() { }
>             };
>
>  Basically we're making an anonymous subclass of Display2D which does
>  our bidding.
>
>  Third, you need to prevent the close box from merely HIDING the
>  Display2D rather than doing something smarter, like exiting the
>  program.  To do this, add this to the very end of your init() method
>  in HeatBugsWithUI:
>
>         // change the behavior of the display so when we close it, the
>  program quits.
>         // other options are:
>         // HIDE_ON_CLOSE        hide the window
>         // DISPOSE_ON_CLOSE     close and delete the window but don't quit the
>  program
>         // DO_NOTHINg_ON_CLOSE  Ignore the close button
>         displayFrame.setDefaultCloseOperation
>  (javax.swing.JFrame.EXIT_ON_CLOSE);
>
>  This isn't the greatest approach because the quit() method is never
>  called on your GUIState.  This has various undesirable results: for
>  example, if the user is making a movie, it won't get flushed out
>  properly when he closes the window.
>
>  Instead you could set the default close operation to be dispose:
>
>         displayFrame.setDefaultCloseOperation
>  (javax.swing.JFrame.EXIT_ON_CLOSE);
>
>  This disposes the window but it doesn't quit the program.  How do we
>  quit the program?  When the Display2D's default JFrame is disposed,
>  the first thing it does is call Display2D.quit().  We can tap into
>  this in our Display2D subclass to call the doClose() method on our
>  console, which clicks the *Console's* close box and quits the program
>  cleanly:
>
>          // Make the Display2D.  We'll have it display stuff later.
>          display = new Display2D(400,400,this,1)
>             {
>             public void createConsoleMenu() { }
>             public void quit()
>                 {
>                 super.quit();
>                 ((Console)c).doClose();
>                 }
>             };
>
>  Not that to do this, you need to make the Controller c final in
>  init's argument list.
>
>  Last, you may wish to eliminate the entire header of the Display2D so
>  the user can't scale, skip frames, make movies, etc.  This is
>  straightforward: in the init method, you just call:
>
>         display.remove(display.header);  // get rid of the header bar
>
>  I've put together an example which does all of this for your viewing
>  pleasure:
>
>
>
>
>
>  Sean
>
>
>
>
>

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

December 2017
November 2017
September 2017
June 2017
May 2017
March 2017
February 2017
January 2017
December 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
December 2010
November 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
February 2010
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
April 2005
March 2005
February 2005
January 2005
December 2004
November 2004
October 2004
September 2004
July 2004
May 2004
April 2004
March 2004

ATOM RSS1 RSS2



LISTSERV.GMU.EDU

CataList Email List Search Powered by the LISTSERV Email List Manager