net.algart.model3d.common.movement
Class MovingSpheresApplet

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by java.applet.Applet
                  extended by javax.swing.JApplet
                      extended by net.algart.model3d.common.movement.MovingSpheresApplet
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, ParameterGetter, StatusShower

public class MovingSpheresApplet
extends javax.swing.JApplet
implements ParameterGetter, StatusShower

Java applet, allowing to customize and view the model (in animation mode) in a browser. This class is based on 3 built-in objects MovingSpheresModel, MovingSpheresView and MovingSpheresController, and add to them only the following operations:

Please see the source code for more details.

AlgART Laboratory 2010

Since:
JDK 1.5
Version:
1.0
Author:
Daniel Alievsky
See Also:
Serialized Form

Nested Class Summary
Modifier and Type Class and Description
 
Nested classes/interfaces inherited from class javax.swing.JApplet
javax.swing.JApplet.AccessibleJApplet
 
Nested classes/interfaces inherited from class java.applet.Applet
java.applet.Applet.AccessibleApplet
 
Nested classes/interfaces inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
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
Modifier and Type Field and Description
 boolean appletReady
           
protected  MovingSpheresController controller
           
protected  MovingSpheresModel model
           
protected  MovingSpheresView view
           
 
Fields inherited from class javax.swing.JApplet
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Constructor and Description
MovingSpheresApplet()
           
 
Method Summary
Modifier and Type Method and Description
 void addElasticBall(double x, double y, double z, double r, double vX, double vY, double vZ)
           
 void addInitialItems()
           
 void addNonintersectingRandomElasticBallsInBunker(int count, double averageRadius, double standardDeviation, double minRadius, double maxRadius)
           
protected  MovingSpheresController createController()
           
protected  MovingSpheresModel createModel()
           
protected  MovingSpheresView createView()
           
 double getAccelerationLimit()
           
 java.lang.String getAppletInfo()
           
 double getBallDensity()
           
 double getBallElasticityModulus()
           
 double getBallFrictionCoefficient()
           
 double getBunkerMaxX()
           
 double getBunkerMaxY()
           
 double getBunkerMaxZ()
           
 double getBunkerMinX()
           
 double getBunkerMinY()
           
 double getBunkerMinZ()
           
 java.lang.String getBunkerWallColor()
           
 double getCoordinateOriginX()
           
 double getCoordinateOriginY()
           
 double getCoordinateOriginZ()
           
 double getDeltaT()
           
 double getEarthGravity()
           
 java.lang.String getItemColor()
           
 double getMediumResistanceCoefficient()
           
 int getMovementIntegratorCode()
           
 double getNumberOfParallelTasks()
           
 double getRefreshTime()
           
 double getScale()
           
 double getT()
           
 double getVelocityLimit()
           
 boolean getViscousForces()
           
 double getZCut()
           
 void init()
           
 void removeAll()
           
 void resetRandSeed()
           
 void rotate(double xAngleInDegree, double yAngleInDegree, double zAngleInDegree)
           
 void setAccelerationLimit(double accelerationLimit)
           
 void setBallDensity(double ballDensity)
           
 void setBallElasticityModulus(double ballElasticityModulus)
           
 void setBallFrictionCoefficient(double ballFrictionCoefficient)
           
 void setBunkerMaxX(double bunkerMaxX)
           
 void setBunkerMaxY(double bunkerMaxY)
           
 void setBunkerMaxZ(double bunkerMaxZ)
           
 void setBunkerMinX(double bunkerMinX)
           
 void setBunkerMinY(double bunkerMinY)
           
 void setBunkerMinZ(double bunkerMinZ)
           
 void setBunkerWallColor(java.lang.String bunkerWallColor)
           
 void setCoordinatesOrigin(double originX, double originY, double originZ)
           
 void setDefaultPositionIJ()
           
 void setDefaultPositionIK()
           
 void setDeltaT(double deltaT)
           
 void setEarthGravity(double earthGravity)
           
 void setItemColor(java.lang.String itemColor)
           
 void setMediumResistanceCoefficient(double mediumResistanceCoefficient)
           
 void setMovementIntegrator(int movementIntegratorCode)
           
 void setNumberOfParallelTasks(int numberOfParallelTasks)
           
 void setOrientation(double ix, double iy, double iz, double jx, double jy, double jz)
           
 void setRandSeed(long seed)
           
 void setRefreshTime(double refreshTime)
           
 void setScale(double value)
           
 void setT(double t)
           
 void setVelocityLimit(double velocityLimit)
           
 void setViscousForces(boolean viscousForces)
           
 void setZCut(double value)
           
 void start()
           
 void startMovement()
           
 void stop()
           
 void stopMovement()
           
 java.lang.String toString()
           
 boolean tryStop(long timeoutInMilliseconds)
           
protected  void waitForSafeModeForChangingModel()
           
 
Methods inherited from class javax.swing.JApplet
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isRootPaneCheckingEnabled, paramString, remove, repaint, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.applet.Applet
destroy, getAppletContext, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, isValidateRoot, newAudioClip, play, play, resize, resize, setStub, showStatus
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.algart.model3d.common.movement.ParameterGetter
getParameter
 
Methods inherited from interface net.algart.model3d.common.movement.StatusShower
showStatus
 

Field Detail

appletReady

public final boolean appletReady
See Also:
Constant Field Values

model

protected MovingSpheresModel model

view

protected MovingSpheresView view

controller

protected MovingSpheresController controller
Constructor Detail

MovingSpheresApplet

public MovingSpheresApplet()
Method Detail

init

public void init()
Overrides:
init in class java.applet.Applet

start

public void start()
Overrides:
start in class java.applet.Applet

stop

public void stop()
Overrides:
stop in class java.applet.Applet

tryStop

public boolean tryStop(long timeoutInMilliseconds)

startMovement

public void startMovement()

stopMovement

public void stopMovement()

resetRandSeed

public void resetRandSeed()

setRandSeed

public void setRandSeed(long seed)

getBunkerMinX

public double getBunkerMinX()

setBunkerMinX

public void setBunkerMinX(double bunkerMinX)

getBunkerMaxX

public double getBunkerMaxX()

setBunkerMaxX

public void setBunkerMaxX(double bunkerMaxX)

getBunkerMinY

public double getBunkerMinY()

setBunkerMinY

public void setBunkerMinY(double bunkerMinY)

getBunkerMaxY

public double getBunkerMaxY()

setBunkerMaxY

public void setBunkerMaxY(double bunkerMaxY)

getBunkerMinZ

public double getBunkerMinZ()

setBunkerMinZ

public void setBunkerMinZ(double bunkerMinZ)

getBunkerMaxZ

public double getBunkerMaxZ()

setBunkerMaxZ

public void setBunkerMaxZ(double bunkerMaxZ)

getEarthGravity

public double getEarthGravity()

setEarthGravity

public void setEarthGravity(double earthGravity)

getBallDensity

public double getBallDensity()

setBallDensity

public void setBallDensity(double ballDensity)

getBallElasticityModulus

public double getBallElasticityModulus()

setBallElasticityModulus

public void setBallElasticityModulus(double ballElasticityModulus)

getBallFrictionCoefficient

public double getBallFrictionCoefficient()

setBallFrictionCoefficient

public void setBallFrictionCoefficient(double ballFrictionCoefficient)

getMediumResistanceCoefficient

public double getMediumResistanceCoefficient()

setMediumResistanceCoefficient

public void setMediumResistanceCoefficient(double mediumResistanceCoefficient)

getViscousForces

public boolean getViscousForces()

setViscousForces

public void setViscousForces(boolean viscousForces)

getAccelerationLimit

public double getAccelerationLimit()

setAccelerationLimit

public void setAccelerationLimit(double accelerationLimit)

getVelocityLimit

public double getVelocityLimit()

setVelocityLimit

public void setVelocityLimit(double velocityLimit)

getT

public double getT()

setT

public void setT(double t)

getDeltaT

public double getDeltaT()

setDeltaT

public void setDeltaT(double deltaT)

removeAll

public void removeAll()
Overrides:
removeAll in class java.awt.Container

addInitialItems

public void addInitialItems()

addElasticBall

public void addElasticBall(double x,
                           double y,
                           double z,
                           double r,
                           double vX,
                           double vY,
                           double vZ)

addNonintersectingRandomElasticBallsInBunker

public void addNonintersectingRandomElasticBallsInBunker(int count,
                                                         double averageRadius,
                                                         double standardDeviation,
                                                         double minRadius,
                                                         double maxRadius)

getNumberOfParallelTasks

public double getNumberOfParallelTasks()

setNumberOfParallelTasks

public void setNumberOfParallelTasks(int numberOfParallelTasks)

getMovementIntegratorCode

public int getMovementIntegratorCode()

setMovementIntegrator

public void setMovementIntegrator(int movementIntegratorCode)

getItemColor

public java.lang.String getItemColor()

setItemColor

public void setItemColor(java.lang.String itemColor)

getBunkerWallColor

public java.lang.String getBunkerWallColor()

setBunkerWallColor

public void setBunkerWallColor(java.lang.String bunkerWallColor)

getCoordinateOriginX

public double getCoordinateOriginX()

getCoordinateOriginY

public double getCoordinateOriginY()

getCoordinateOriginZ

public double getCoordinateOriginZ()

setCoordinatesOrigin

public void setCoordinatesOrigin(double originX,
                                 double originY,
                                 double originZ)

getScale

public double getScale()

setScale

public void setScale(double value)

setOrientation

public void setOrientation(double ix,
                           double iy,
                           double iz,
                           double jx,
                           double jy,
                           double jz)

rotate

public void rotate(double xAngleInDegree,
                   double yAngleInDegree,
                   double zAngleInDegree)

getZCut

public double getZCut()

setZCut

public void setZCut(double value)

setDefaultPositionIJ

public void setDefaultPositionIJ()

setDefaultPositionIK

public void setDefaultPositionIK()

getRefreshTime

public double getRefreshTime()

setRefreshTime

public void setRefreshTime(double refreshTime)

getAppletInfo

public java.lang.String getAppletInfo()
Overrides:
getAppletInfo in class java.applet.Applet

toString

public java.lang.String toString()
Overrides:
toString in class java.awt.Component

createModel

protected MovingSpheresModel createModel()

createView

protected MovingSpheresView createView()

createController

protected MovingSpheresController createController()

waitForSafeModeForChangingModel

protected void waitForSafeModeForChangingModel()