|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container java.awt.Window java.awt.Frame javax.swing.JFrame org.opensourcephysics.display.OSPFrame org.opensourcephysics.controls.ControlFrame org.opensourcephysics.controls.OSPControl
public class OSPControl
A Control that shows its parameters in a JTable. Custom buttons can be added.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JFrame |
---|
javax.swing.JFrame.AccessibleJFrame |
Nested classes/interfaces inherited from class java.awt.Frame |
---|
java.awt.Frame.AccessibleAWTFrame |
Nested classes/interfaces inherited from class java.awt.Window |
---|
java.awt.Window.AccessibleAWTWindow |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary |
---|
Fields inherited from class org.opensourcephysics.controls.ControlFrame |
---|
clearItem, copyItem, displayMenu, editMenu, fileMenu, inspectItem, languageItems, languageMenu, logToFileItem, model, ospApp, printFrameItem, readItem, saveAsItem, saveFrameAsEPSItem, sizeDownItem, sizeUpItem, xmlDefault |
Fields inherited from class org.opensourcephysics.display.OSPFrame |
---|
animated, autoclear, buttonPanel, childFrames, constructorThreadGroup, customButtons, keepHidden, strategy |
Fields inherited from class javax.swing.JFrame |
---|
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled |
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 org.opensourcephysics.controls.Control |
---|
NOT_EDITABLE_BACKGROUND |
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 |
Constructor Summary | |
---|---|
OSPControl(java.lang.Object _model)
Constructs an OSPControl. |
Method Summary | |
---|---|
javax.swing.JButton |
addButton(java.lang.String methodName,
java.lang.String text)
Adds a custom button to the control's frame. |
javax.swing.JButton |
addButton(java.lang.String methodName,
java.lang.String text,
java.lang.String toolTipText)
Adds a custom button to the control's frame. |
void |
addControlListener(java.lang.String methodName)
Adds a ControlTableListener that invokes method in the control's model. |
void |
addControlListener(java.lang.String methodName,
java.lang.Object target)
Adds a ControlTableListener that invokes method in the given object. |
void |
calculationDone(java.lang.String message)
A signal that a method has completed. |
void |
clearMessages()
Remove all text from the message area. |
void |
clearValues()
Remove all text from the data input area. |
static OSPControl |
createApp(java.lang.Object model)
Creates an OSP control and establishes communication between the control and the model. |
boolean |
getBoolean(java.lang.String par)
Reads a parameter value from the input display. |
double |
getDouble(java.lang.String par)
Reads a parameter value from the input display. |
int |
getInt(java.lang.String par)
Reads a parameter value from the input display. |
static XML.ObjectLoader |
getLoader()
Returns an XML.ObjectLoader to save and load data for this object. |
OSPFrame |
getMainFrame()
Gets this frame. |
java.lang.Object |
getModel()
|
java.lang.Object |
getObject(java.lang.String par)
Gets the object with the specified property name. |
java.util.Collection<java.lang.String> |
getPropertyNames()
Reads the current property names. |
java.lang.String |
getString(java.lang.String par)
Reads a parameter value from the input display. |
protected void |
init()
Initializes this control after all objects have been created. |
protected javax.swing.JMenu |
loadDisplayMenu()
Adds a Display menu to the menu bar. |
void |
print(java.lang.String s)
Prints text in the message area. |
void |
println()
Prints a blank line in the message area. |
void |
println(java.lang.String s)
Prints a line of text in the message area. |
void |
propertyChange(java.beans.PropertyChangeEvent e)
Listens for property change events. |
protected void |
refreshGUI()
Refreshes the user interface in response to display changes such as Language. |
void |
removeParameter(java.lang.String par)
Removes a parameter from the table. |
void |
setDividerLocation(int loc)
Sets the location of the divider between the control table and the message panel. |
void |
setEditable(java.lang.String parameter,
boolean editable)
Sets the editable property of the given parameter so that it can not be changed from within the GUI. |
void |
setLockValues(boolean lock)
Locks the control's interface. |
void |
setValue(java.lang.String par,
boolean val)
Adds an initial boolean value of a parameter to the input display. |
void |
setValue(java.lang.String par,
double val)
Adds an initial value of a parameter to the input display. |
void |
setValue(java.lang.String par,
int val)
Adds an initial value of a parameter to the input display. |
void |
setValue(java.lang.String par,
java.lang.Object val)
Adds a parameter to the input display. |
java.lang.String |
toString()
Creates a string representation of the control parameters. |
Methods inherited from class org.opensourcephysics.controls.ControlFrame |
---|
copy, getOSPApp, inspectXML, loadXML, loadXML, loadXML, loadXML, readParameters, save, saveXML |
Methods inherited from class org.opensourcephysics.display.OSPFrame |
---|
addButton, addChildFrame, bufferStrategyShow, clearChildFrames, clearData, clearDataAndRepaint, createBufferStrategy, dispose, getChildFrames, getChooser, getConstructorThreadGroup, getMenu, invalidateImage, isAnimated, isAutoclear, isIconified, isKeepHidden, loadToolsMenu, parseXMLMenu, parseXMLMenu, removeMenu, removeMenuItem, render, setAnimated, setAutoclear, setDefaultCloseOperation, setFontLevel, setKeepHidden, setSize, setTitle, setVisible, show, wishesToExit |
Methods inherited from class javax.swing.JFrame |
---|
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, 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, setUndecorated |
Methods inherited from class java.awt.Window |
---|
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, toBack, toFront |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.opensourcephysics.controls.MainFrame |
---|
addChildFrame, clearChildFrames, getChildFrames, getOSPApp |
Methods inherited from interface org.opensourcephysics.display.AppFrame |
---|
getDefaultCloseOperation |
Methods inherited from interface java.awt.MenuContainer |
---|
getFont, postEvent |
Constructor Detail |
---|
public OSPControl(java.lang.Object _model)
_model
- Method Detail |
---|
public OSPFrame getMainFrame()
getMainFrame
in interface MainFrame
protected javax.swing.JMenu loadDisplayMenu()
loadDisplayMenu
in class ControlFrame
protected void refreshGUI()
refreshGUI
in class ControlFrame
public void propertyChange(java.beans.PropertyChangeEvent e)
propertyChange
in interface java.beans.PropertyChangeListener
e
- the property change eventprotected void init()
public java.lang.Object getModel()
public void setDividerLocation(int loc)
loc
- intpublic void setEditable(java.lang.String parameter, boolean editable)
parameter
- Stringeditable
- booleanpublic void setLockValues(boolean lock)
setLockValues
in interface Control
lock
- booleanpublic java.lang.String toString()
toString
in class java.awt.Component
public void setValue(java.lang.String par, java.lang.Object val)
setValue
in interface Control
par
- the parameter nameval
- the initial parameter valuepublic void setValue(java.lang.String par, boolean val)
setValue
in interface Control
par
- the parameter nameval
- the initial parameter valuepublic void setValue(java.lang.String par, double val)
setValue
in interface Control
par
- the parameter nameval
- the initial parameter valuepublic void setValue(java.lang.String par, int val)
setValue
in interface Control
par
- the parameter nameval
- the initial parameter valuepublic void removeParameter(java.lang.String par)
par
- the parameter namepublic double getDouble(java.lang.String par)
getDouble
in interface Control
par
-
public int getInt(java.lang.String par)
getInt
in interface Control
par
-
public java.lang.Object getObject(java.lang.String par) throws java.lang.UnsupportedOperationException
getObject
in interface Control
par
-
java.lang.UnsupportedOperationException
public java.lang.String getString(java.lang.String par)
getString
in interface Control
par
- the parameter name
public boolean getBoolean(java.lang.String par)
getBoolean
in interface Control
par
- the parameter name
public java.util.Collection<java.lang.String> getPropertyNames()
getPropertyNames
in interface Control
public javax.swing.JButton addButton(java.lang.String methodName, java.lang.String text)
methodName
- the name of the method; the method has no parameterstext
- the button's text label
public javax.swing.JButton addButton(java.lang.String methodName, java.lang.String text, java.lang.String toolTipText)
methodName
- the name of the method; the method has no parameterstext
- the button's text labeltoolTipText
- the button's tool tip text
public void addControlListener(java.lang.String methodName)
methodName
- the name of the method; the method has no parameterspublic void addControlListener(java.lang.String methodName, java.lang.Object target)
methodName
- the name of the method; the method has no parameterstarget
- the target for the methodpublic void println(java.lang.String s)
println
in interface Control
s
- public void println()
println
in interface Control
public void print(java.lang.String s)
print
in interface Control
s
- public void clearMessages()
clearMessages
in interface Control
public void clearValues()
clearValues
in interface Control
public void calculationDone(java.lang.String message)
calculationDone
in interface Control
message
- public static XML.ObjectLoader getLoader()
public static OSPControl createApp(java.lang.Object model)
model
- Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |