java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Window
java.awt.Frame
javax.swing.JFrame
org.nlogo.app.App
public final class 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.shapes.editor.ManagerDialog |
linkShapesManager
|
org.nlogo.shapes.editor.ManagerDialog |
turtleShapesManager
|
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 | |
|---|---|
JMenu |
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 |
createEditMenu()
|
JMenu |
createFileMenu()
|
JMenu |
createToolsMenu()
|
JMenu |
createZoomMenu()
|
Object[] |
getLinkComponents()
Internal use only. |
String |
getProcedures()
Returns the contents of the Procedures tab. |
String |
getSource(String filename)
|
void |
handle(Throwable throwable)
Internal use only. |
void |
handleAboutToQuitEvent(org.nlogo.event.AboutToQuitEvent e)
|
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 |
handleLoadSectionEvent(org.nlogo.event.LoadSectionEvent e)
|
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. |
void |
quit()
Quits NetLogo by exiting the JVM. |
Object |
report(String source)
Runs a NetLogo reporter. |
void |
requestFocus()
Internal use only. |
void |
resizeWorld(int minPxcor,
int maxPxcor,
int minPycor,
int maxPycor)
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, setIconImage, 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, 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.
public org.nlogo.shapes.editor.ManagerDialog turtleShapesManager
public org.nlogo.shapes.editor.ManagerDialog linkShapesManager
| Method Detail |
|---|
public static void main(String[] args)
app.
This method must not be called from the AWT event queue thread.
args - Should be empty. (Passing non-empty arguments
is not currently documented.)
public void quit()
throws org.nlogo.util.UserCancelException
org.nlogo.util.UserCancelExceptionpublic JMenu createFileMenu()
createFileMenu in interface org.nlogo.swing.MenuBarFactorypublic JMenu createEditMenu()
createEditMenu in interface org.nlogo.swing.MenuBarFactorypublic JMenu createToolsMenu()
createToolsMenu in interface org.nlogo.swing.MenuBarFactorypublic JMenu createZoomMenu()
createZoomMenu in interface org.nlogo.swing.MenuBarFactorypublic JMenu addHelpMenu(JMenuBar menuBar)
addHelpMenu in interface org.nlogo.swing.MenuBarFactorypublic void handleAppEvent(org.nlogo.event.AppEvent e)
handleAppEvent in interface org.nlogo.event.AppEvent.Handlerpublic void handleSwitchedTabsEvent(org.nlogo.app.SwitchedTabsEvent e)
handleSwitchedTabsEvent in interface org.nlogo.app.SwitchedTabsEvent.Handlerpublic void handleModelSavedEvent(org.nlogo.event.ModelSavedEvent e)
handleModelSavedEvent in interface org.nlogo.event.ModelSavedEvent.Handlerpublic void handleLoadBeginEvent(org.nlogo.event.LoadBeginEvent e)
handleLoadBeginEvent in interface org.nlogo.event.LoadBeginEvent.Handlerpublic void handleBeforeLoadEvent(org.nlogo.event.BeforeLoadEvent e)
handleBeforeLoadEvent in interface org.nlogo.event.BeforeLoadEvent.Handlerpublic void handleLoadEndEvent(org.nlogo.event.LoadEndEvent e)
handleLoadEndEvent in interface org.nlogo.event.LoadEndEvent.Handlerpublic void handleAboutToQuitEvent(org.nlogo.event.AboutToQuitEvent e)
handleAboutToQuitEvent in interface org.nlogo.event.AboutToQuitEvent.Handlerpublic void requestFocus()
requestFocus in class Componentpublic void handle(Throwable throwable)
handle in interface org.nlogo.util.ExceptionsHandler
public void open(String path)
throws IOException
open in interface Controllablepath - 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 Controllablesource - 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 Controllablesource - The reporter to run
LogoList,
Agent, AgentSet, or Nobody
CompilerException - if the code fails to compile
IllegalStateException - if called from the AWT event queue thread
public void resizeWorld(int minPxcor,
int maxPxcor,
int minPycor,
int maxPycor)
minPxcor - new value for min-pxcormaxPxcor - new value for max-pxcorminPycor - new value for min-pycormaxPycor - new value for max-pycorpublic 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 handleLoadSectionEvent(org.nlogo.event.LoadSectionEvent e)
handleLoadSectionEvent in interface org.nlogo.event.LoadSectionEvent.Handlerpublic String getSource(String filename)
getSource in interface org.nlogo.window.ExternalFileManagerpublic void addLinkComponent(Object c)
public Object[] getLinkComponents()
getLinkComponents in interface org.nlogo.event.EventLinkContainer