Class EjsControlFrame
java.lang.Object
org.opensourcephysics.ejs.control.GroupControl
org.opensourcephysics.ejs.control.EjsControl
org.opensourcephysics.ejs.control.ParsedEjsControl
org.opensourcephysics.ejs.control.EjsControlFrame
- All Implemented Interfaces:
RootPaneContainer,Control,MainFrame,SimControl
- Direct Known Subclasses:
EjsCalculationControl,EjsSimulationControl
EjsControlFrame defines an Easy Java Simulations control that is guaranteed
to have a parent frame.
- Version:
- 1.0
- Author:
- Wolfgang Christian
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected OSPApplicationprotected JMenuItemprotected JMenuItem[]protected JMenuprotected JFrameprotected Toolprotected JMenuItemprotected PropertyChangeSupportprotected JMenuItemprotected JMenuItemprotected XMLControlElementFields inherited from class org.opensourcephysics.ejs.control.GroupControl
DEBUG_ALL, DEBUG_CONTROL, DEBUG_CONTROL_VERBOSE, DEBUG_DRAWING, DEBUG_DRAWING_VERBOSE, DEBUG_ELEMENTS, DEBUG_NONE, DEBUG_SET_AND_GET, DEBUG_SYSTEM, DEBUG_SYSTEM_VERBOSE, replaceOwnerFrame, replaceOwnerNameFields inherited from interface org.opensourcephysics.controls.Control
NOT_EDITABLE_BACKGROUND -
Constructor Summary
ConstructorsConstructorDescriptionEjsControlFrame(Object _simulation) Constructor EjsControlFrameEjsControlFrame(Object _simulation, String param) Constructor EjsControlFrame -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChildFrame(JFrame child) Adds a child frame that depends on the main frame.Adds an existing object to this control.voidAdds a PropertyChangeListener.voidcalculationDone(String message) Stops the animation and prints a message.voidClears the child frames from the main frame.voidClears data from drawing objects within this frame.voidClears data from drawing objects within this frame.voidClears the current XML default.voidRemove all text from the message area.Gets a copy of the ChildFrames collection.Gets the frame's content pane.getFrame()Deprecated.Implementation of RootPaneContainer.Implementation of RootPaneContainer.Gets the OSPFrame that contains the control.int[]Gets the Main Frame size.Gets the OSP Application controlled by this frame.Gets the frame's root pane.Gets the frame that contains the control.voidvoidLoads the current XML default.protected voidAdds a Display menu to the menu bar.protected JMenuAdds a Tools menu to the menu bar.voidloadXML()voidvoidvoidloadXML(XMLControlElement xml, boolean compatibleModel) voidparseXMLMenu(String xmlMenu) voidPrints a string in the control's message area.voidprintln()Prints a blank line in the control's message area.voidPrints a string in the control's message area followed by a CR and LF.intprintToGraphics(Graphics g, PageFormat pageFormat, int pageIndex) Draws the frame into a graphics object suitable for printing.protected voidvoidRemoves a PropertyChangeListener.voidrender()Renders the frame.voidsaveXML()voidsetContentPane(Container contentPane) Sets the frame's content pane.voidsetGlassPane(Component glassPane) Implementation of RootPaneContainer.voidsetLayeredPane(JLayeredPane layeredPane) Implementation of RootPaneContainer.Methods inherited from class org.opensourcephysics.ejs.control.ParsedEjsControl
getDouble, getInt, getObject, removeParameter, setAdjustableValue, setAdjustableValue, setAdjustableValue, setAdjustableValue, setParameterToFixedMethods inherited from class org.opensourcephysics.ejs.control.EjsControl
clearValues, getPropertyNames, getPropertyNamesRaw, getValue, reset, setLockValues, setValueMethods inherited from class org.opensourcephysics.ejs.control.GroupControl
add, add, addListener, addListener, addNamed, addObject, addTarget, appendPrefixPath, clear, clearPrefixPath, clearVariables, destroy, destroy, getBoolean, getComponent, getContainer, getControl, getDebugLevel, getDefaultPrefixList, getElement, getLoader, getOwnerFrame, getReplaceOwnerFrame, getReplaceOwnerName, getSimulation, getString, getTarget, getTopLevelAncestor, getVisual, initialize, isVariableRegistered, registerVariable, removeTarget, rename, replaceOwnerFrame, setActive, setDebugLevel, setOwnerFrame, setSimulation, setValue, setValue, setValue, setValue, setValue, update, variableChangedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opensourcephysics.controls.Control
clearValues, getBoolean, getPropertyNames, getPropertyNamesRaw, getString, setLockValues, setValue, setValue, setValue, setValue, setValue
-
Field Details
-
reply
-
languageItems
-
translateItem
-
snapshotItem
-
videoItem
-
clearItem
-
languageMenu
-
messageFrame
-
xmlDefault
-
support
-
app
-
-
Constructor Details
-
EjsControlFrame
Constructor EjsControlFrame- Parameters:
_simulation-
-
EjsControlFrame
Constructor EjsControlFrame- Parameters:
_simulation-param-
-
-
Method Details
-
addChildFrame
Adds a child frame that depends on the main frame. Child frames are closed when this frame is closed.- Specified by:
addChildFramein interfaceMainFrame- Parameters:
mainFrame- JFrame
-
clearChildFrames
public void clearChildFrames()Clears the child frames from the main frame.- Specified by:
clearChildFramesin interfaceMainFrame
-
getChildFrames
Gets a copy of the ChildFrames collection.- Specified by:
getChildFramesin interfaceMainFrame- Returns:
- Collection
-
getMainFrame
Gets the OSPFrame that contains the control. The main frame will usually exit program when it is closed.- Specified by:
getMainFramein interfaceMainFrame- Returns:
-
getMainFrameSize
public int[] getMainFrameSize()Gets the Main Frame size. -
getFrame
Deprecated.Gets the OSPFrame that contains the control. Replaced by getMainFrame to implement MainFrame interface.- Returns:
-
loadToolsMenu
Adds a Tools menu to the menu bar. -
loadDisplayMenu
protected void loadDisplayMenu()Adds a Display menu to the menu bar. -
printToGraphics
public int printToGraphics(Graphics g, PageFormat pageFormat, int pageIndex) throws PrinterException Draws the frame into a graphics object suitable for printing.- Parameters:
g-pageFormat-pageIndex-- Returns:
- status code
- Throws:
PrinterException
-
refreshGUI
protected void refreshGUI() -
addPropertyChangeListener
Adds a PropertyChangeListener.- Parameters:
listener- the object requesting property change notification
-
removePropertyChangeListener
Removes a PropertyChangeListener.- Parameters:
listener- the listener requesting removal
-
println
Prints a string in the control's message area followed by a CR and LF. GUI controls will usually display messages in a non-editable text area.- Specified by:
printlnin interfaceControl- Overrides:
printlnin classEjsControl- Parameters:
s-
-
println
public void println()Prints a blank line in the control's message area. GUI controls will usually display messages in a non-editable text area.- Specified by:
printlnin interfaceControl- Overrides:
printlnin classEjsControl
-
print
Prints a string in the control's message area. GUI controls will usually display messages in a non-editable text area.- Specified by:
printin interfaceControl- Overrides:
printin classEjsControl- Parameters:
s-
-
clearMessages
public void clearMessages()Remove all text from the message area.- Specified by:
clearMessagesin interfaceControl- Overrides:
clearMessagesin classEjsControl
-
calculationDone
Stops the animation and prints a message.- Specified by:
calculationDonein interfaceControl- Overrides:
calculationDonein classEjsControl- Parameters:
message- String
-
render
public void render()Renders the frame. Subclass this method to render the contents of this frame in the calling thread. -
addObject
Adds an existing object to this control.- Overrides:
addObjectin classEjsControl- Parameters:
object- Objectclassname- StringpropList- String- Returns:
- ControlElement
-
clearData
public void clearData()Clears data from drawing objects within this frame. Override this method to clear objects that have data. -
clearDataAndRepaint
public void clearDataAndRepaint()Clears data from drawing objects within this frame. Override this method to clear and repaint objects that have data. -
getTopLevelAncestor
Gets the frame that contains the control.- Returns:
-
getRootPane
Gets the frame's root pane. Implementation of RootPaneContainer.- Specified by:
getRootPanein interfaceRootPaneContainer- Returns:
-
getContentPane
Gets the frame's content pane. Implementation of RootPaneContainer.- Specified by:
getContentPanein interfaceRootPaneContainer- Returns:
- content pane of the frame
-
setContentPane
Sets the frame's content pane. Implementation of RootPaneContainer.- Specified by:
setContentPanein interfaceRootPaneContainer- Parameters:
contentPane-
-
getLayeredPane
Implementation of RootPaneContainer.- Specified by:
getLayeredPanein interfaceRootPaneContainer- Returns:
- layeredPane of the frame
- See Also:
-
setLayeredPane
Implementation of RootPaneContainer.- Specified by:
setLayeredPanein interfaceRootPaneContainer- Parameters:
layeredPane-- See Also:
-
getGlassPane
Implementation of RootPaneContainer.- Specified by:
getGlassPanein interfaceRootPaneContainer- Returns:
- glass pane component
- See Also:
-
setGlassPane
Implementation of RootPaneContainer.- Specified by:
setGlassPanein interfaceRootPaneContainer- Parameters:
glassPane-- See Also:
-
parseXMLMenu
-
saveXML
public void saveXML() -
getOSPApp
Gets the OSP Application controlled by this frame. -
loadDefaultXML
public void loadDefaultXML()Loads the current XML default. -
clearDefaultXML
public void clearDefaultXML()Clears the current XML default. -
loadXML
-
loadXML
-
loadXML
public void loadXML() -
inspectXML
public void inspectXML() -
loadXML
-