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 OSPApplication
protected JMenuItem
protected JMenuItem[]
protected JMenu
protected JFrame
protected Tool
protected JMenuItem
protected PropertyChangeSupport
protected JMenuItem
protected JMenuItem
protected XMLControlElement
Fields 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, replaceOwnerName
Fields 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 TypeMethodDescriptionvoid
addChildFrame
(JFrame child) Adds a child frame that depends on the main frame.Adds an existing object to this control.void
Adds a PropertyChangeListener.void
calculationDone
(String message) Stops the animation and prints a message.void
Clears the child frames from the main frame.void
Clears data from drawing objects within this frame.void
Clears data from drawing objects within this frame.void
Clears the current XML default.void
Remove 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.void
void
Loads the current XML default.protected void
Adds a Display menu to the menu bar.protected JMenu
Adds a Tools menu to the menu bar.void
loadXML()
void
void
void
loadXML
(XMLControlElement xml, boolean compatibleModel) void
parseXMLMenu
(String xmlMenu) void
Prints a string in the control's message area.void
println()
Prints a blank line in the control's message area.void
Prints a string in the control's message area followed by a CR and LF.int
printToGraphics
(Graphics g, PageFormat pageFormat, int pageIndex) Draws the frame into a graphics object suitable for printing.protected void
void
Removes a PropertyChangeListener.void
render()
Renders the frame.void
saveXML()
void
setContentPane
(Container contentPane) Sets the frame's content pane.void
setGlassPane
(Component glassPane) Implementation of RootPaneContainer.void
setLayeredPane
(JLayeredPane layeredPane) Implementation of RootPaneContainer.Methods inherited from class org.opensourcephysics.ejs.control.ParsedEjsControl
getDouble, getInt, getObject, removeParameter, setAdjustableValue, setAdjustableValue, setAdjustableValue, setAdjustableValue, setParameterToFixed
Methods inherited from class org.opensourcephysics.ejs.control.EjsControl
clearValues, getPropertyNames, getPropertyNamesRaw, getValue, reset, setLockValues, setValue
Methods 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, variableChanged
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
addChildFrame
in interfaceMainFrame
- Parameters:
mainFrame
- JFrame
-
clearChildFrames
public void clearChildFrames()Clears the child frames from the main frame.- Specified by:
clearChildFrames
in interfaceMainFrame
-
getChildFrames
Gets a copy of the ChildFrames collection.- Specified by:
getChildFrames
in interfaceMainFrame
- Returns:
- Collection
-
getMainFrame
Gets the OSPFrame that contains the control. The main frame will usually exit program when it is closed.- Specified by:
getMainFrame
in 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:
println
in interfaceControl
- Overrides:
println
in 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:
println
in interfaceControl
- Overrides:
println
in 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:
print
in interfaceControl
- Overrides:
print
in classEjsControl
- Parameters:
s
-
-
clearMessages
public void clearMessages()Remove all text from the message area.- Specified by:
clearMessages
in interfaceControl
- Overrides:
clearMessages
in classEjsControl
-
calculationDone
Stops the animation and prints a message.- Specified by:
calculationDone
in interfaceControl
- Overrides:
calculationDone
in 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:
addObject
in 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:
getRootPane
in interfaceRootPaneContainer
- Returns:
-
getContentPane
Gets the frame's content pane. Implementation of RootPaneContainer.- Specified by:
getContentPane
in interfaceRootPaneContainer
- Returns:
- content pane of the frame
-
setContentPane
Sets the frame's content pane. Implementation of RootPaneContainer.- Specified by:
setContentPane
in interfaceRootPaneContainer
- Parameters:
contentPane
-
-
getLayeredPane
Implementation of RootPaneContainer.- Specified by:
getLayeredPane
in interfaceRootPaneContainer
- Returns:
- layeredPane of the frame
- See Also:
-
setLayeredPane
Implementation of RootPaneContainer.- Specified by:
setLayeredPane
in interfaceRootPaneContainer
- Parameters:
layeredPane
-- See Also:
-
getGlassPane
Implementation of RootPaneContainer.- Specified by:
getGlassPane
in interfaceRootPaneContainer
- Returns:
- glass pane component
- See Also:
-
setGlassPane
Implementation of RootPaneContainer.- Specified by:
setGlassPane
in 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
-