|
NetLogo API version 3.0.2 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Window
java.awt.Frame
javax.swing.JFrame
org.nlogo.app.App
The main class for the complete NetLogo application.
All methods in this class, including the constructor, must be called from the AWT event queue thread, unless otherwise specified.
See the "Controlling" section of the NetLogo User Manual for example code.
Field Summary | |
static App |
app
Once main() has been called, holds the singleton
instance of this class. |
org.nlogo.window.GUIWorkspace |
workspace
|
Fields inherited from class javax.swing.JFrame |
EXIT_ON_CLOSE |
Fields inherited from class java.awt.Frame |
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.WindowConstants |
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Method Summary | |
void |
addHelpMenu(JMenuBar menuBar)
|
void |
addLinkComponent(Object c)
Internal use only. |
void |
command(String source)
Runs NetLogo commands and waits for them to complete. |
void |
commandLater(String source)
Runs NetLogo commands in the background. |
void |
compile()
Recompiles the model. |
JMenu |
createFileMenu()
|
JMenu |
createToolsMenu()
|
JMenu |
createZoomMenu()
|
Object[] |
getLinkComponents()
Internal use only. |
String |
getProcedures()
Returns the contents of the Procedures tab. |
void |
handle(Throwable throwable)
Internal use only. |
void |
handleAppEvent(org.nlogo.event.AppEvent e)
Internal use only. |
void |
handleBeforeLoadEvent(org.nlogo.event.BeforeLoadEvent e)
Internal use only. |
void |
handleLoadBeginEvent(org.nlogo.event.LoadBeginEvent e)
Internal use only. |
void |
handleLoadEndEvent(org.nlogo.event.LoadEndEvent e)
Internal use only. |
void |
handleModelSavedEvent(org.nlogo.event.ModelSavedEvent e)
Internal use only. |
void |
handleSwitchedTabsEvent(org.nlogo.app.SwitchedTabsEvent e)
Internal use only. |
static void |
main(String[] args)
Should be called once at startup to create the application and start it running. |
void |
makeWidget(String text)
Adds new widget to Interface tab given its specification, in the same (undocumented) format found in a saved model. |
void |
open(String path)
Opens a model stored in a file. |
void |
openFromSource(String name,
String source)
Opens a model stored in a string. |
void |
pressButton(String name)
Not currently supported. |
Object |
report(String source)
Runs a NetLogo reporter. |
void |
requestFocus()
Internal use only. |
void |
resizeWorld(int screenEdgeX,
int screenEdgeY)
Kills all turtles, clears all patch variables, and makes a new patch grid. |
void |
selectTab(int number)
Switches tabs. |
void |
setProcedures(String source)
Replaces the contents of the Procedures tab. |
Methods inherited from class javax.swing.JFrame |
getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, update |
Methods inherited from class java.awt.Frame |
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.awt.MenuContainer |
getFont, postEvent |
Field Detail |
public final org.nlogo.window.GUIWorkspace workspace
public static App app
main()
has been called, holds the singleton
instance of this class.
Method Detail |
public static void main(String[] args)
app
.
args
- Should be empty. (Passing non-empty arguments
is not currently documented.)public JMenu createFileMenu()
createFileMenu
in interface org.nlogo.swing.JMenuBarFactory
public JMenu createToolsMenu()
createToolsMenu
in interface org.nlogo.swing.JMenuBarFactory
public JMenu createZoomMenu()
createZoomMenu
in interface org.nlogo.swing.JMenuBarFactory
public void addHelpMenu(JMenuBar menuBar)
addHelpMenu
in interface org.nlogo.swing.JMenuBarFactory
public void handleAppEvent(org.nlogo.event.AppEvent e)
handleAppEvent
in interface org.nlogo.event.AppEvent.Handler
public void handleSwitchedTabsEvent(org.nlogo.app.SwitchedTabsEvent e)
handleSwitchedTabsEvent
in interface org.nlogo.app.SwitchedTabsEvent.Handler
public void handleModelSavedEvent(org.nlogo.event.ModelSavedEvent e)
handleModelSavedEvent
in interface org.nlogo.event.ModelSavedEvent.Handler
public void handleLoadBeginEvent(org.nlogo.event.LoadBeginEvent e)
handleLoadBeginEvent
in interface org.nlogo.event.LoadBeginEvent.Handler
public void handleBeforeLoadEvent(org.nlogo.event.BeforeLoadEvent e)
handleBeforeLoadEvent
in interface org.nlogo.event.BeforeLoadEvent.Handler
public void handleLoadEndEvent(org.nlogo.event.LoadEndEvent e)
handleLoadEndEvent
in interface org.nlogo.event.LoadEndEvent.Handler
public void requestFocus()
public void handle(Throwable throwable)
handle
in interface org.nlogo.util.ExceptionsHandler
public void open(String path) throws IOException
path
- the path (absolute or relative) of the NetLogo model to open.
IOException
public void openFromSource(String name, String source)
name
- Model name (will appear in the main window's title bar)source
- The complete model, including widgets and so forth,
in the same format as it would be stored in a file.public void command(String source) throws CompilerException
This method must not be called from the AWT event queue thread or while that thread is blocked. It is an error to do so.
command
in interface org.nlogo.workspace.Controllable
source
- The command or commands to run
CompilerException
- if the code fails to compile
IllegalStateException
- if called from the AWT event queue threadcommandLater(java.lang.String)
public void commandLater(String source) throws CompilerException
This method may be called from any thread.
source
- The command or commands to run
CompilerException
- if the code fails to compilecommand(java.lang.String)
public Object report(String source) throws CompilerException
This method must not be called from the AWT event queue thread or while that thread is blocked. It is an error to do so.
report
in interface org.nlogo.workspace.Controllable
source
- The reporter to run
LogoList
,
Agent
, AgentSet, or Nobody
CompilerException
- if the code fails to compile
IllegalStateException
- if called from the AWT event queue threadpublic void resizeWorld(int screenEdgeX, int screenEdgeY)
screenEdgeX
- new value for screen-edge-xscreenEdgeY
- new value for screen-edge-ypublic String getProcedures()
public void setProcedures(String source)
source
- new contentscompile()
public void compile()
setProcedures()
.
setProcedures(java.lang.String)
public void selectTab(int number)
number
- which tab to switch to. 0 is the Interface tab,
1 the Information tab, 2 the Procedures tab, 3 the
Errors tab.public void pressButton(String name)
command
or commandLater()
instead.
name
- the button to presscommand(java.lang.String)
,
commandLater(java.lang.String)
public void makeWidget(String text)
text
- the widget specificationpublic void addLinkComponent(Object c)
public Object[] getLinkComponents()
getLinkComponents
in interface org.nlogo.event.EventLinkContainer
|
NetLogo API version 3.0.2 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |