org.nlogo.lite
Class AppletPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.nlogo.lite.AppletPanel
- All Implemented Interfaces:
- ImageObserver, MenuContainer, Serializable, Accessible, org.nlogo.util.Exceptions.Handler, org.nlogo.window.Event.LinkParent
- Direct Known Subclasses:
- InterfaceComponent
public abstract class AppletPanel
- extends JPanel
- implements org.nlogo.util.Exceptions.Handler, org.nlogo.window.Event.LinkParent
The superclass of org.nlogo.lite.InterfaceComponent.
Also used by org.nlogo.lite.Applet.
See the "Controlling" section of the NetLogo User Manual
for example code.
- See Also:
- Serialized Form
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
AppletPanel
public AppletPanel(Frame frame,
MouseListener iconListener,
boolean isApplet)
requestFocus
public void requestFocus()
- AppletPanel passes the focus request to the InterfacePanel
- Overrides:
requestFocus
in class JComponent
setAdVisible
public void setAdVisible(boolean visible)
- internal use only
setPrefix
public void setPrefix(URL url)
- sets the current working directory
- Parameters:
url
- the directory as java.net.URL
handle
public void handle(Throwable throwable)
- internal use only
- Specified by:
handle
in interface org.nlogo.util.Exceptions.Handler
addLinkComponent
public void addLinkComponent(Object c)
- internal use only
getLinkChildren
public Object[] getLinkChildren()
- internal use only
- Specified by:
getLinkChildren
in interface org.nlogo.window.Event.LinkParent
command
public void command(String source)
throws CompilerException
- Runs NetLogo commands and waits for them to complete.
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.
- Parameters:
source
- The command or commands to run
- Throws:
CompilerException
- if the code fails to compile
IllegalStateException
- if called from the AWT event queue thread- See Also:
commandLater(java.lang.String)
commandLater
public void commandLater(String source)
throws CompilerException
- Runs NetLogo commands in the background. Returns immediately,
without waiting for the commands to finish.
This method may be called from any thread.
- Parameters:
source
- The command or commands to run
- Throws:
CompilerException
- if the code fails to compile- See Also:
command(java.lang.String)
report
public Object report(String source)
throws CompilerException
- Runs a NetLogo reporter.
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.
- Parameters:
source
- The reporter to run
- Returns:
- the result reported; may be of type java.lang.Integer, java.lang.Double,
java.lang.Boolean, java.lang.String,
LogoList
,
Agent
, AgentSet, or Nobody
- Throws:
CompilerException
- if the code fails to compile
IllegalStateException
- if called from the AWT event queue thread
getProcedures
public String getProcedures()
- Returns the contents of the Procedures tab.
- Returns:
- contents of Procedures tab
setProcedures
public void setProcedures(String source)
- Replaces the contents of the Procedures tab.
Does not recompile the model.
- Parameters:
source
- new contents
openFromSource
public void openFromSource(String name,
String path,
String source)
throws org.nlogo.window.InvalidVersionException
- Opens a model stored in a string.
- Parameters:
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.
- Throws:
org.nlogo.window.InvalidVersionException
main
public static void main(String[] args)