java.awt.event.ActionListener, java.awt.print.Printable, java.util.EventListener, Renderable, DrawingPanel3D, InteractionSourcepublic class DrawingPanel3D extends javax.swing.JPanel implements Renderable, DrawingPanel3D, java.awt.print.Printable, java.awt.event.ActionListener
Title: DrawingPanel3D
Description: The simple3D implementation of a DrawingPanel3D.
Interaction: The panel has only one target, the panel itself. If enabled, the panel issues MOUSE_ENTER, MOUSE_EXIT, MOUSE_MOVED, and MOUSE_DRAGGED InteractionEvents with target=null. When the ALT key is held, the panel also issues MOUSE_PRESSED, MOUSE_DRAGGED (again), and MOUSE_RELEASED InteractionEvents. In this second case, the getInfo() method of the event returns a double[3] with the coordinates of the point selected.
Even if the panel is disabled, the panel can be panned, zoomed and (in 3D modes) rotated and the elements in it can be enabled.
The interaction capabilities are not XML serialized.
Copyright: Open Source Physics project
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategyjava.awt.Container.AccessibleAWTContainerDrawingPanel3D.Loader| Modifier and Type | Field | Description |
|---|---|---|
protected TextPanel |
blMessageBox |
|
protected TextPanel |
brMessageBox |
|
protected org.opensourcephysics.display3d.simple3d.DrawingPanel3D.GlassPanel |
glassPanel |
|
protected OSPLayout |
glassPanelLayout |
|
protected TextPanel |
tlMessageBox |
|
protected TextPanel |
trMessageBox |
|
protected VideoTool |
vidCap |
The video capture tool for this panel.
|
protected java.awt.Rectangle |
viewRect |
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTAMBIENT_LIGHT, BACKGROUND, BOTTOM_LEFT, BOTTOM_RIGHT, DIRECTIONAL_LIGHT, MODE_XYZ, MODE_XZY, MODE_YXZ, MODE_YZX, MODE_ZXY, MODE_ZYX, POINT_LIGHT, SPOT_LIGHT, TARGET_PANEL, TOP_LEFT, TOP_RIGHTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor | Description |
|---|---|
DrawingPanel3D() |
Constructor DrawingPanel3D
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
actionPerformed(java.awt.event.ActionEvent evt) |
Performs an action for the update timer by rendering a new background image
|
void |
addElement(Element element) |
Adds an Element to this DrawingPanel3D.
|
void |
addInteractionListener(InteractionListener listener) |
Adds the specified interaction listener to receive interaction events
to any of its targets from this source.
|
int |
getAxesMode() |
Returns the axes mode
|
java.lang.String |
getBackgroundImage() |
Returns the background image
|
Camera |
getCamera() |
Provides the Camera object used to project the scene in 3D modes.
|
java.awt.Component |
getComponent() |
Getting the pointer to the real JPanel in it
|
java.util.List<Element> |
getElements() |
Gets the (cloned) list of Elements.
|
InteractionTarget |
getInteractionTarget(int target) |
Gives access to one of the targets of this source.
|
static XML.ObjectLoader |
getLoader() |
Returns an XML.ObjectLoader to save and load object data.
|
double |
getPreferredMaxX() |
Gets the preferred maximum in the X coordinate
|
double |
getPreferredMaxY() |
Gets the preferred maximum in the Y coordinate
|
double |
getPreferredMaxZ() |
Gets the preferred maximum in the Z coordinate
|
double |
getPreferredMinX() |
Gets the preferred minimum in the X coordinate
|
double |
getPreferredMinY() |
Gets the preferred minimum in the Y coordinate
|
double |
getPreferredMinZ() |
Gets the preferred minimum in the Z coordinate
|
double |
getScaleFactorX() |
Gets the scale factor in the X axis
|
double |
getScaleFactorY() |
Gets the scale factor in the Y axis
|
double |
getScaleFactorZ() |
Gets the scale factor in the Z axis
|
VideoTool |
getVideoTool() |
Gets the video capture tool.
|
VisualizationHints |
getVisualizationHints() |
Provides the list of visualization hints that the panel uses
to display the 3D scene
|
void |
invalidate() |
Invalidates this component.
|
boolean |
isSquareAspect() |
Whether the panel tries to keep a square aspect.
|
void |
paintComponent(java.awt.Graphics g) |
Paints the component by copying the offscreen image into the graphics context.
|
int |
print(java.awt.Graphics g,
java.awt.print.PageFormat pageFormat,
int pageIndex) |
|
void |
removeAllElements() |
Removes all Elements from this DrawingPanel3D
|
void |
removeElement(Element element) |
Removes an Element from this DrawingPanel3D
|
void |
removeInteractionListener(InteractionListener listener) |
Removes the specified interaction listener
|
java.awt.image.BufferedImage |
render() |
Renders a representation of the object onscreen.
|
java.awt.image.BufferedImage |
render(java.awt.image.BufferedImage image) |
Renders a representation of the object onto an image.
|
void |
setAxesMode(int mode) |
Sets the axes mode
|
void |
setBackgroundImage(java.lang.String _imageFile) |
Sets the background image
|
void |
setIgnoreRepaint(boolean ignoreRepaint) |
|
void |
setLightEnabled(boolean _state,
int nlight) |
Enable disable a light
|
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.
|
void |
setPreferredMinMax(double minX,
double maxX,
double minY,
double maxY,
double minZ,
double maxZ) |
Sets the preferred extrema for the panel.
|
void |
setScaleFactor(double factorX,
double factorY,
double factorZ) |
Sets the scale factor of the scene in X,Y,Z axis.
|
void |
setSquareAspect(boolean square) |
Whether the panel should try to keep a square aspect.
|
void |
setVideoTool(VideoTool videoCap) |
Sets the video capture tool.
|
void |
zoomToFit() |
Sets the preferred min and max in each dimension so that all
elements currently in the panel are visible.
|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleadd, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreerepaintaddAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, 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, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateprotected TextPanel trMessageBox
protected TextPanel tlMessageBox
protected TextPanel brMessageBox
protected TextPanel blMessageBox
protected org.opensourcephysics.display3d.simple3d.DrawingPanel3D.GlassPanel glassPanel
protected OSPLayout glassPanelLayout
protected java.awt.Rectangle viewRect
protected VideoTool vidCap
public void actionPerformed(java.awt.event.ActionEvent evt)
actionPerformed in interface java.awt.event.ActionListenerevt - public void setIgnoreRepaint(boolean ignoreRepaint)
setIgnoreRepaint in class java.awt.Componentpublic void paintComponent(java.awt.Graphics g)
paintComponent in class javax.swing.JComponentg - Graphicspublic void invalidate()
invalidate in class java.awt.ContainerContainer.validate(),
Container.doLayout(),
LayoutManagerpublic java.awt.image.BufferedImage render(java.awt.image.BufferedImage image)
Renderablerender in interface DrawingPanel3Drender in interface Renderableimage - Imagepublic java.awt.image.BufferedImage render()
Renderablerender in interface DrawingPanel3Drender in interface Renderablepublic java.awt.Component getComponent()
DrawingPanel3DgetComponent in interface DrawingPanel3Dpublic void setBackgroundImage(java.lang.String _imageFile)
DrawingPanel3DsetBackgroundImage in interface DrawingPanel3Dpublic java.lang.String getBackgroundImage()
DrawingPanel3DgetBackgroundImage in interface DrawingPanel3Dpublic void setPreferredMinMax(double minX,
double maxX,
double minY,
double maxY,
double minZ,
double maxZ)
DrawingPanel3DsetPreferredMinMax in interface DrawingPanel3DminX - doublemaxX - doubleminY - doublemaxY - doubleminZ - doublemaxZ - doubleCamerapublic final double getPreferredMinX()
DrawingPanel3DgetPreferredMinX in interface DrawingPanel3Dpublic final double getPreferredMaxX()
DrawingPanel3DgetPreferredMaxX in interface DrawingPanel3Dpublic final double getPreferredMinY()
DrawingPanel3DgetPreferredMinY in interface DrawingPanel3Dpublic final double getPreferredMaxY()
DrawingPanel3DgetPreferredMaxY in interface DrawingPanel3Dpublic final double getPreferredMinZ()
DrawingPanel3DgetPreferredMinZ in interface DrawingPanel3Dpublic final double getPreferredMaxZ()
DrawingPanel3DgetPreferredMaxZ in interface DrawingPanel3Dpublic void zoomToFit()
DrawingPanel3DzoomToFit in interface DrawingPanel3Dpublic void setSquareAspect(boolean square)
DrawingPanel3DsetSquareAspect in interface DrawingPanel3Dsquare - booleanpublic boolean isSquareAspect()
DrawingPanel3DisSquareAspect in interface DrawingPanel3Dpublic VisualizationHints getVisualizationHints()
DrawingPanel3DgetVisualizationHints in interface DrawingPanel3DVisualizationHintspublic Camera getCamera()
DrawingPanel3DgetCamera in interface DrawingPanel3DCamerapublic VideoTool getVideoTool()
getVideoTool in interface DrawingPanel3Dpublic void setVideoTool(VideoTool videoCap)
setVideoTool in interface DrawingPanel3DvideoCap - the video capture toolpublic void addElement(Element element)
DrawingPanel3DaddElement in interface DrawingPanel3Delement - ElementElementpublic void removeElement(Element element)
DrawingPanel3DremoveElement in interface DrawingPanel3Delement - ElementElementpublic void removeAllElements()
DrawingPanel3DremoveAllElements in interface DrawingPanel3DElementpublic java.util.List<Element> getElements()
DrawingPanel3DgetElements in interface DrawingPanel3Dpublic void setScaleFactor(double factorX,
double factorY,
double factorZ)
DrawingPanel3DsetScaleFactor in interface DrawingPanel3DfactorX - doublefactorY - doublefactorZ - doublepublic double getScaleFactorX()
DrawingPanel3DgetScaleFactorX in interface DrawingPanel3Dpublic double getScaleFactorY()
DrawingPanel3DgetScaleFactorY in interface DrawingPanel3Dpublic double getScaleFactorZ()
DrawingPanel3DgetScaleFactorZ in interface DrawingPanel3Dpublic void setAxesMode(int mode)
DrawingPanel3DsetAxesMode in interface DrawingPanel3Dmode - intpublic int getAxesMode()
DrawingPanel3DgetAxesMode in interface DrawingPanel3Dpublic void setMessage(java.lang.String msg)
msg - public void setMessage(java.lang.String msg,
int location)
msg - location - public InteractionTarget getInteractionTarget(int target)
InteractionSourcegetInteractionTarget in interface InteractionSourcetarget - An integer number that identifies the target in the source.public void addInteractionListener(InteractionListener listener)
InteractionSourceaddInteractionListener in interface InteractionSourcelistener - An object that implements the InteractionListener interfaceInteractionListenerpublic void removeInteractionListener(InteractionListener listener)
InteractionSourceremoveInteractionListener in interface InteractionSourceInteractionListenerpublic int print(java.awt.Graphics g,
java.awt.print.PageFormat pageFormat,
int pageIndex)
throws java.awt.print.PrinterException
print in interface java.awt.print.Printablejava.awt.print.PrinterExceptionpublic void setLightEnabled(boolean _state,
int nlight)
DrawingPanel3DsetLightEnabled in interface DrawingPanel3Dpublic static XML.ObjectLoader getLoader()