|
|||||||||
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.display.DrawingFrame
public class DrawingFrame
Drawing Frame: a frame that contains a drawing panel.
Nested Class Summary | |
---|---|
protected static class |
DrawingFrame.DrawingFrameLoader
|
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 | |
---|---|
protected javax.swing.JMenuItem |
copyItem
|
protected java.awt.Window |
customInspector
|
protected DrawingPanel |
drawingPanel
|
protected javax.swing.JMenu |
editMenu
|
protected javax.swing.JMenu |
fileMenu
|
protected static int |
MENU_SHORTCUT_KEY_MASK
|
protected javax.swing.JMenuItem |
pasteItem
|
protected javax.swing.JMenuItem |
replaceItem
|
protected Tool |
reply
|
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 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 | |
---|---|
DrawingFrame()
DrawingFrame constructor that creates a default DrawingPanel. |
|
DrawingFrame(DrawingPanel drawingPanel)
DrawingFrame constructor specifying the DrawingPanel that will be placed in the center of the content pane. |
|
DrawingFrame(java.lang.String title,
DrawingPanel _drawingPanel)
DrawingFrame constructor specifying the title and the DrawingPanel that will be placed in the center of the content pane. |
Method Summary | ||
---|---|---|
void |
addDrawable(Drawable drawable)
Adds a drawable object to the frame's drawing panel. |
|
protected void |
addMenuItems()
Adds Views menu items on the menu bar. |
|
void |
clearDataAndRepaint()
Clears data and repaints the drawing panel within this frame. |
|
void |
clearDrawables()
Clears Drawable objects added by the user from this frame. |
|
protected void |
copyAction(XMLControlElement control)
Copies objects found in the specified xml control. |
|
DrawableAxes |
getAxes()
|
|
java.util.ArrayList<Drawable> |
getDrawables()
Gets Drawable previously objects added by the user. |
|
|
getDrawables(java.lang.Class<T> c)
Gets Drawable objects added by the user of an assignable type. |
|
DrawingPanel |
getDrawingPanel()
Gets the drawing panel. |
|
static XML.ObjectLoader |
getLoader()
Returns an XML.ObjectLoader to save and load data for this program. |
|
|
getObjectOfClass(java.lang.Class<T> c)
Gets objects of a specific class from the drawing panel. |
|
void |
inspectXML()
Inspects the drawing frame by using an xml document tree. |
|
void |
invalidateImage()
Invalidates image buffers if a drawing panel buffered. |
|
boolean |
isAutoscaleX()
Determines if the panel's x axis autoscale property is true. |
|
boolean |
isAutoscaleY()
Determines if the y axis autoscale property is true. |
|
void |
limitAutoscaleX(double floor,
double ceil)
Limits the xmin and xmax values during autoscaling so that the mininimum value will be no greater than the floor and the maximum value will be no smaller than the ceil. |
|
void |
limitAutoscaleY(double floor,
double ceil)
Limits ymin and ymax values during autoscaling so that the mininimum value will be no greater than the floor and the maximum value will be no smaller than the ceil. |
|
protected javax.swing.JMenu |
loadDisplayMenu()
Adds a Display menu to the menu bar. |
|
protected javax.swing.JMenu |
loadToolsMenu()
Adds a Tools menu to the menu bar. |
|
void |
lostOwnership(java.awt.datatransfer.Clipboard clipboard,
java.awt.datatransfer.Transferable contents)
Implementation of ClipboardOwner interface. |
|
void |
paint(java.awt.Graphics g)
This is a hack to fix a bug when the reload button is pressed in browsers running JDK 1.4. |
|
protected void |
pasteAction(XMLControlElement control)
Pastes drawables found in the specified xml control. |
|
protected void |
refreshGUI()
Refreshes the user interface in response to display changes such as Language. |
|
void |
removeDrawable(Drawable drawable)
Removes a drawable object to the frame's drawing panel. |
|
|
removeObjectsOfClass(java.lang.Class<T> c)
Removes all objects of the given class from the drawable list. |
|
void |
render()
Renders the drawing panel if the frame is showing and not iconified. |
|
void |
replaceAction(XMLControlElement control)
Replaces the drawables with the drawables found in the specified XML control. |
|
void |
replaceDrawable(Drawable oldDrawable,
Drawable newDrawable)
Replaces a Drawable object with another Drawable. |
|
void |
saveXML()
|
|
void |
setAutoscaleX(boolean autoscale)
Autoscale the drawing panel's x axis using min and max values. |
|
void |
setAutoscaleY(boolean autoscale)
Autoscale the y axis using min and max values. |
|
void |
setCartesian(java.lang.String xLabel,
java.lang.String yLabel,
java.lang.String plotTitle)
Converts to cartesian coordinates. |
|
void |
setCustomInspector(java.awt.Window w)
Sets a custom properties inspector window. |
|
void |
setDrawingPanel(DrawingPanel _drawingPanel)
Adds the drawing panel to the the frame. |
|
void |
setEnabledCopy(boolean enable)
Enables the copy edit menu item. |
|
void |
setEnabledPaste(boolean enable)
Enables the paste edit menu item. |
|
void |
setEnabledReplace(boolean enable)
Enables the replace edit menu item. |
|
void |
setInteractiveMouseHandler(InteractiveMouseHandler handler)
Sets the interactive mouse handler if the drawing panel is an interactive panel. |
|
void |
setInteriorBackground(java.awt.Color color)
Sets the interior background color for the current drawing panel. |
|
void |
setLogScale(boolean logX,
boolean logY)
Sets Cartesian axes to log scale. |
|
void |
setMessage(java.lang.String msg)
Shows a message in a yellow text box in the lower right hand corner. |
|
void |
setMessage(java.lang.String msg,
int location)
Shows a message in a yellow text box at the given location. |
|
void |
setPixelsPerUnit(boolean enable,
double xPixPerUnit,
double yPixPerUnit)
Sets the scale using pixels per unit. |
|
void |
setPolar(java.lang.String plotTitle,
double deltaR)
Converts to polar coordinates. |
|
void |
setPreferredMinMax(double xmin,
double xmax,
double ymin,
double ymax)
Sets the drawing panel's preferred scale. |
|
void |
setPreferredMinMaxX(double xmin,
double xmax)
Sets the drawing panel's preferred scale in the horizontal direction. |
|
void |
setPreferredMinMaxY(double ymin,
double ymax)
Sets the drawing panel's preferred scale in the vertical direction. |
|
void |
setSquareAspect(boolean isSquare)
Sets the aspect ratio for horizontal to vertical to unity when true<\code>. |
|
void |
setXLabel(java.lang.String label)
Sets the label for the X (horizontal) axis. |
|
void |
setYLabel(java.lang.String label)
Sets the label for the Y (vertical) axis. |
Methods inherited from class org.opensourcephysics.display.OSPFrame |
---|
addButton, addChildFrame, bufferStrategyShow, clearChildFrames, clearData, createBufferStrategy, dispose, getChildFrames, getChooser, getConstructorThreadGroup, getMenu, isAnimated, isAutoclear, isIconified, isKeepHidden, parseXMLMenu, parseXMLMenu, removeMenu, removeMenuItem, 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, 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, toString, 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.display.AppFrame |
---|
getDefaultCloseOperation |
Methods inherited from interface java.awt.MenuContainer |
---|
getFont, postEvent |
Field Detail |
---|
protected javax.swing.JMenu fileMenu
protected javax.swing.JMenu editMenu
protected javax.swing.JMenuItem copyItem
protected javax.swing.JMenuItem pasteItem
protected javax.swing.JMenuItem replaceItem
protected DrawingPanel drawingPanel
protected static final int MENU_SHORTCUT_KEY_MASK
protected java.awt.Window customInspector
protected Tool reply
Constructor Detail |
---|
public DrawingFrame()
public DrawingFrame(DrawingPanel drawingPanel)
drawingPanel
- public DrawingFrame(java.lang.String title, DrawingPanel _drawingPanel)
title
- _drawingPanel
- Method Detail |
---|
public void render()
render
in class OSPFrame
public void invalidateImage()
invalidateImage
in class OSPFrame
public DrawingPanel getDrawingPanel()
public void setXLabel(java.lang.String label)
label
- the labelpublic void setYLabel(java.lang.String label)
label
- the labelpublic void setPolar(java.lang.String plotTitle, double deltaR)
plotTitle
- StringdeltaR
- doublepublic void setCartesian(java.lang.String xLabel, java.lang.String yLabel, java.lang.String plotTitle)
xLabel
- StringyLabel
- StringplotTitle
- Stringpublic void limitAutoscaleX(double floor, double ceil)
Double.NaN<\code> will disable that limit.
- Parameters:
floor
- the xfloor valueceil
- the xceil value
public void limitAutoscaleY(double floor, double ceil)
Double.NaN<\code> will disable that limit.
- Parameters:
floor
- the yfloor valueceil
- the yceil value
public void setAutoscaleX(boolean autoscale)
autoscale
- public boolean isAutoscaleX()
true<\code> if autoscaled.
public void setAutoscaleY(boolean autoscale)
autoscale
- public boolean isAutoscaleY()
true<\code> if autoscaled.
public void setSquareAspect(boolean isSquare)
true<\code>.
- Parameters:
isSquare
- boolean
public void setLogScale(boolean logX, boolean logY)
logX
- logY
- public void setPixelsPerUnit(boolean enable, double xPixPerUnit, double yPixPerUnit)
enable
- boolean enable fixed pixels per unitxPixPerUnit
- doubleyPixPerUnit
- doublepublic void setPreferredMinMax(double xmin, double xmax, double ymin, double ymax)
xmin
- xmax
- ymin
- ymax
- public void setPreferredMinMaxY(double ymin, double ymax)
ymin
- ymax
- public void setPreferredMinMaxX(double xmin, double xmax)
xmin
- the minimum valuexmax
- the maximum valuepublic void clearDataAndRepaint()
clearDataAndRepaint
in class OSPFrame
public void clearDrawables()
public void addDrawable(Drawable drawable)
drawable
- public void replaceDrawable(Drawable oldDrawable, Drawable newDrawable)
oldDrawable
- DrawablenewDrawable
- Drawablepublic void removeDrawable(Drawable drawable)
drawable
- public void setMessage(java.lang.String msg)
msg
- public void setMessage(java.lang.String msg, int location)
msg
- location
- public <T extends Drawable> java.util.ArrayList<T> getObjectOfClass(java.lang.Class<T> c)
c
- the class of the object
public java.util.ArrayList<Drawable> getDrawables()
public DrawableAxes getAxes()
public <T extends Drawable> java.util.ArrayList<T> getDrawables(java.lang.Class<T> c)
c
- the type of Drawable object
getObjectOfClass(Class c)
public <T extends Drawable> void removeObjectsOfClass(java.lang.Class<T> c)
c
- the classpublic void setInteractiveMouseHandler(InteractiveMouseHandler handler)
handler
- the mouse handlerpublic void setDrawingPanel(DrawingPanel _drawingPanel)
_drawingPanel
- public void setInteriorBackground(java.awt.Color color)
public void paint(java.awt.Graphics g)
paint
in class java.awt.Container
g
- public void setEnabledPaste(boolean enable)
enable
- booleanprotected void pasteAction(XMLControlElement control)
control
- the xml controlpublic void setEnabledReplace(boolean enable)
enable
- booleanpublic void replaceAction(XMLControlElement control)
control
- XMLControlElementprotected void copyAction(XMLControlElement control)
control
- the xml controlpublic void lostOwnership(java.awt.datatransfer.Clipboard clipboard, java.awt.datatransfer.Transferable contents)
lostOwnership
in interface java.awt.datatransfer.ClipboardOwner
clipboard
- Clipboardcontents
- Transferablepublic void setEnabledCopy(boolean enable)
enable
- booleanprotected void refreshGUI()
OSPFrame
refreshGUI
in class OSPFrame
protected void addMenuItems()
protected javax.swing.JMenu loadDisplayMenu()
loadDisplayMenu
in class OSPFrame
protected javax.swing.JMenu loadToolsMenu()
loadToolsMenu
in class OSPFrame
public void setCustomInspector(java.awt.Window w)
w
- the new inspector windowpublic void inspectXML()
public void saveXML()
public static XML.ObjectLoader getLoader()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |