Java API by
Zvi Har’El

kaleido
Class Scope

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 kaleido.Scope
All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, Runnable, EventListener, Accessible

public class Scope
extends Applet
implements Runnable, ActionListener

The class Scope 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.Scope 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 Uniform.
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 Scope, Polyhedron, Uniform, Vector3D and Rational. This excludes the classes Kaleido and Output.

Version:
$Id: Scope.java,v 1.78 2007/02/09 20:08:18 rl Exp $
Author:
Zvi Har’El
See Also:
Class source code, Applet demo, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.applet.Applet
Applet.AccessibleApplet
 
Nested classes/interfaces inherited from class java.awt.Panel
Panel.AccessibleAWTPanel
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
(package private)  double azimuth
          Direction in space of rotation axis.
private  Button back
          References to buttons.
(package private)  Font bigFont
          Font for titles.
(package private)  boolean blue
          Boolean flag describing the color setup.
(package private)  Thread clock
          An object reference to the clock thread.
(package private)  Color[] color
          The 16 chosen display colors.
(package private) static String copyright
          Copyright notice.
private  boolean disabled
          True if a button was disabeled.
(package private)  double elevation
          Direction in space of rotation axis.
(package private)  boolean green
          Boolean flag describing the color setup.
(package private)  Object in
          Input source.
(package private)  int index
          Index of polyhedron in the input.
(package private)  boolean light
          Boolean flag describing the color setup.
private  long lostTime
          Accumulated time of pausing in millis.
private  Button next
          References to buttons.
(package private)  Polyhedron P
          An object reference to the currently showing polyhedron.
(package private)  boolean red
          Boolean flag describing the color setup.
(package private)  Font smallFont
          Font for subtitles.
private  long stoppedAt
          System current millis when rotation stopped.
(package private)  boolean uniform
          If true, the uniform polyhedron is on display.
(package private) static String version
          Version information.
 
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
Scope()
           
 
Method Summary
 void actionPerformed(ActionEvent e)
           
private  Button button(String s)
           
 String getAppletInfo()
           
 void init()
          Initializes the applet.
private  Polyhedron next()
          Returns the next polyhedron from the input source.
 void paint(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(Graphics g)
          Update the display by computing the new rotation angle and invoking the Polyhedron.paint(kaleido.Scope, 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, 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
 

Field Detail

version

static final String version
Version information.

See Also:
Constant Field Values

copyright

static final String copyright
Copyright notice.

See Also:
Constant Field Values

in

Object in
Input source.


index

int index
Index of polyhedron in the input.


P

Polyhedron P
An object reference to the currently showing polyhedron.


uniform

boolean uniform
If true, the uniform polyhedron is on display. Otherwise, its dual is showing.


color

Color[] color
The 16 chosen display colors.


bigFont

Font bigFont
Font for titles.


smallFont

Font smallFont
Font for subtitles.


clock

Thread clock
An object reference to the clock thread.


red

boolean red
Boolean flag describing the color setup.


green

boolean green
Boolean flag describing the color setup.


blue

boolean blue
Boolean flag describing the color setup.


light

boolean light
Boolean flag describing the color setup.


azimuth

double azimuth
Direction in space of rotation axis.


elevation

double elevation
Direction in space of rotation axis.


stoppedAt

private long stoppedAt
System current millis when rotation stopped.


lostTime

private long lostTime
Accumulated time of pausing in millis.


next

private Button next
References to buttons. Used for enbling and disabling them.


back

private Button back
References to buttons. Used for enbling and disabling them.


disabled

private boolean disabled
True if a button was disabeled.

Constructor Detail

Scope

public Scope()
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 Applet
See Also:
Color, Button

getAppletInfo

public String getAppletInfo()
Overrides:
getAppletInfo in class Applet

button

private Button button(String s)

actionPerformed

public void actionPerformed(ActionEvent e)
Specified by:
actionPerformed in interface ActionListener

start

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

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

stop

public void stop()
Stop the clock thread.

Overrides:
stop in class Applet

run

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

Specified by:
run in interface Runnable

paint

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

Overrides:
paint in class Container

update

public void update(Graphics g)
Update the display by computing the new rotation angle and invoking the Polyhedron.paint(kaleido.Scope, 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 Container

next

private Polyhedron next()
Returns the next polyhedron from the input source.


Java API by
Zvi Har’El

Copyright © Zvi Har’El
$Date: 2007/10/15 13:50:30$