org.opensourcephysics.drawing3d.simple3d
Class SimpleDrawingPanel3D

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.opensourcephysics.drawing3d.simple3d.SimpleDrawingPanel3D
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.print.Printable, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, Renderable, ImplementingPanel

public class SimpleDrawingPanel3D
extends javax.swing.JPanel
implements ImplementingPanel, java.awt.print.Printable, java.awt.event.ActionListener

Title: SimpleDrawingPanel3D

Description: The simple3d implementation of a DrawingPanel3D.

Copyright: Open Source Physics project

Version:
August 2009
Author:
Francisco Esquembre, Wolfgang Christian
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
SimpleDrawingPanel3D(DrawingPanel3D _panel)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent evt)
          Performs an action for the update timer by rendering a new background image
 void cameraChanged(int howItChanged)
          This will be called by the camera whenever it changes.
 void forceRefresh()
          Tells the implementing panel that a change makes its current view obsolete.
 java.awt.Component getComponent()
          Returns the actual Swing component
 void invalidate()
          Invalidates this component.
 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)
           
 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 setFastRedraw(boolean fast)
          Sets a flags to redraw as fast as possible.
 void setIgnoreRepaint(boolean ignoreRepaint)
          Tell the panels whether the simulation thread will repaint the scene
 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 update()
          Updates the panel immediately For instance, when the min-max value change
 void visualizationChanged(int _change)
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleDrawingPanel3D

public SimpleDrawingPanel3D(DrawingPanel3D _panel)
Method Detail

getComponent

public java.awt.Component getComponent()
Description copied from interface: ImplementingPanel
Returns the actual Swing component

Specified by:
getComponent in interface ImplementingPanel
Returns:
java.awt.Component

forceRefresh

public void forceRefresh()
Description copied from interface: ImplementingPanel
Tells the implementing panel that a change makes its current view obsolete. For instance, when the min-max value change. But the update needs not be immediate.

Specified by:
forceRefresh in interface ImplementingPanel

update

public void update()
Description copied from interface: ImplementingPanel
Updates the panel immediately For instance, when the min-max value change

Specified by:
update in interface ImplementingPanel

setFastRedraw

public void setFastRedraw(boolean fast)
Description copied from interface: ImplementingPanel
Sets a flags to redraw as fast as possible. Typically during an interaction

Specified by:
setFastRedraw in interface ImplementingPanel

cameraChanged

public void cameraChanged(int howItChanged)
Description copied from interface: ImplementingPanel
This will be called by the camera whenever it changes.

Specified by:
cameraChanged in interface ImplementingPanel
See Also:
Camera

setMessage

public void setMessage(java.lang.String msg)
Description copied from interface: ImplementingPanel
Shows a message in a yellow text box in the lower right hand corner.

Specified by:
setMessage in interface ImplementingPanel

setMessage

public void setMessage(java.lang.String msg,
                       int location)
Description copied from interface: ImplementingPanel
Shows a message in a yellow text box. The location must be one of the following:

Specified by:
setMessage in interface ImplementingPanel

render

public java.awt.image.BufferedImage render(java.awt.image.BufferedImage image)
Description copied from interface: Renderable
Renders a representation of the object onto an image.

Specified by:
render in interface Renderable
Returns:
the image buffer

render

public java.awt.image.BufferedImage render()
Description copied from interface: Renderable
Renders a representation of the object onscreen.

Specified by:
render in interface Renderable

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent evt)
Performs an action for the update timer by rendering a new background image

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
evt -

setIgnoreRepaint

public void setIgnoreRepaint(boolean ignoreRepaint)
Tell the panels whether the simulation thread will repaint the scene

Overrides:
setIgnoreRepaint in class java.awt.Component
Parameters:
ignoreRepaint -

paintComponent

public void paintComponent(java.awt.Graphics g)
Paints the component by copying the offscreen image into the graphics context.

Overrides:
paintComponent in class javax.swing.JComponent
Parameters:
g - Graphics

invalidate

public void invalidate()
Invalidates this component. This component and all parents above it are marked as needing to be laid out. This method can be called often, so it needs to execute quickly.

Overrides:
invalidate in class java.awt.Container
Since:
JDK1.0
See Also:
Container.validate(), Container.doLayout(), LayoutManager

print

public int print(java.awt.Graphics g,
                 java.awt.print.PageFormat pageFormat,
                 int pageIndex)
          throws java.awt.print.PrinterException
Specified by:
print in interface java.awt.print.Printable
Throws:
java.awt.print.PrinterException

visualizationChanged

public void visualizationChanged(int _change)
Specified by:
visualizationChanged in interface ImplementingPanel