org.jscience.mathematics.geometry.polyhedrons
Class PolyhedronDisplayer

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 org.jscience.mathematics.geometry.polyhedrons.PolyhedronDisplayer
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.lang.Runnable, java.util.EventListener, javax.accessibility.Accessible

public class PolyhedronDisplayer
extends java.applet.Applet
implements java.lang.Runnable, java.awt.event.ActionListener

The class Kaleidoscope is loaded by a web browser or by the Java Applet Viewer. It contains the code decode the HTML parameters and start displaying the applet embedded in the web page.

The relevant HTML fragment is:

<APPLET CODE=kaleido.Kaleidoscope ARCHIVE=scope.jar WIDTH=400 HEIGHT=480>
<PARAM NAME=COLOR VALUE=GR>
<IMG SRC=kaleido.gif BORDER=0>
<BR>
Sorry, you need a Java enabled browser to see this in action...
</APPLET>

The case-nonsensitive applet parameters are:

color
One of more of the letters RGBL. The first three represent a color as a combination of the basic colors red, green and blue. This determines the forefround basic color, with the backgroung being black. If the letter L, light, is specified, the background color is determined by the other letters, and the forground is painted in black. The default colors are white on black.
input
A list of polyhedron symbols. The symbols are seperated a comma, a period, a colon or a semicolon. A valid symbol is a number sign followed by a decimal number between one and eighty, or a Withoff symbol, i.e, three rational numbers and a vertical bar. The default list is given in UniformPolyhedrons.
azimuth
elevation
The direction in space of the rotation axis of the polyhedron. Both are angles, given in degrees. The default values are 180/7 and 180/17, respectively.
In cases that kaleido is run as a full fledged application, the applet is embedded within a Kaleido, and the run parameters are explained there.

The applet archive scope.jar includes all the classes in this package which are necessary to display an applet. This includes the classes PolyhedronDisplayer, Polyhedron, UniformPolyhedrons, Vector3D and Rational. This excludes the classes Kaleido and PolyhedronVRMLOutputter.

See Also:
Class source code, Applet demo, Serialized Form

Nested Class Summary
 
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
 
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
PolyhedronDisplayer()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 java.lang.String getAppletInfo()
           
 void init()
          Initializes the applet.
 void paint(java.awt.Graphics g)
          If there is a polylehedron to display, invoke update(java.awt.Graphics).
 void run()
          The clock thread activity method.
 void start()
          Start the clock thead.
 void stop()
          Stop the clock thread.
 void update(java.awt.Graphics g)
          Update the display by computing the new rotation angle and invoking the Polyhedron.paint(org.jscience.mathematics.geometry.polyhedrons.PolyhedronDisplayer, java.awt.Graphics, double, boolean) method.
 
Methods inherited from class java.applet.Applet
destroy, getAccessibleContext, getAppletContext, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, 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, addImpl, 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, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, 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, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, 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, 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, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PolyhedronDisplayer

public PolyhedronDisplayer()
Method Detail

init

public void init()
Initializes the applet. Invoked by the applet browser and by the Kaleido constructor. Reads the applet parametes, sets the display colors, and build the display buttons.

Overrides:
init in class java.applet.Applet
See Also:
Color, Button

getAppletInfo

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

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

start

public void start()
Start the clock thead. Compensating for lost time in pausing periods.

Overrides:
start in class java.applet.Applet
See Also:
Thread.start()

stop

public void stop()
Stop the clock thread.

Overrides:
stop in class java.applet.Applet

run

public void run()
The clock thread activity method. Repaints the screen 10 times in a second.

Specified by:
run in interface java.lang.Runnable

paint

public void paint(java.awt.Graphics g)
If there is a polylehedron to display, invoke update(java.awt.Graphics).

Overrides:
paint in class java.awt.Container

update

public void update(java.awt.Graphics g)
Update the display by computing the new rotation angle and invoking the Polyhedron.paint(org.jscience.mathematics.geometry.polyhedrons.PolyhedronDisplayer, java.awt.Graphics, double, boolean) method. The angle is conmputed from the system clock, compensating for pausing periods, and a rate of 1 revolution in 5 seconds (12 RPM).

Overrides:
update in class java.awt.Container