Chemistry Applets

David N. Blauch


bulb
Class Bulb

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--bulb.Bulb

public class Bulb
extends java.applet.Applet

A spherical bulb with a stopcock is displayed.

Applet Parameters

NAME Variable Type Default Description
BGColor String null String containing a representation of an integer describing the RGB color for the applet background.
Diameter int 0 Diameter in pixels of the bulb. If the value is zero, the applet automatically sets the diameter to fill the available area.
GasColor String #A0FFFF String containing a representation of an integer describing the RGB color of the gas in the bulb.
TubeLength int 40 Length in pixels of the tube bearing the stopcock.

Version:
1.0
Author:
David N. Blauch
See Also:
Serialized Form

Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
Bulb()
           
 
Method Summary
 void destroy()
           
 java.lang.String getAppletInfo()
           
 java.lang.String getParameter(java.lang.String key, java.lang.String def)
           
 java.lang.String[][] getParameterInfo()
           
 void init()
           
 void paint(java.awt.Graphics g)
           
 void setDiameter(int _diameter)
          Sets the diameter of the bulb.
 void setGasColor(int _red, int _green, int _blue)
          Sets the color of the gas in the bulb.
 void setGasColor(java.lang.String _color)
          Sets the color of the gas in the bulb.
 void setLiquidColor(int _red, int _green, int _blue)
          Sets the color of the liquid at the bottom of the bulb
 void setLiquidFraction(double _fraction)
          Sets the amount of liquid shown at the bottom of the bulb
 void setShowLiquid(boolean _showLiquid)
          Determines whether the liquid at the bottom of the bulb is shown or not.
 void setStopcockState(boolean _state)
          Sets the state of the stopcock.
 void start()
           
 void stop()
           
 
Methods inherited from class java.applet.Applet
getAppletContext, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, 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, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setCursor, setFont, setLayout, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, 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, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Bulb

public Bulb()
Method Detail

getParameter

public java.lang.String getParameter(java.lang.String key,
                                     java.lang.String def)

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

destroy

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

getAppletInfo

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

getParameterInfo

public java.lang.String[][] getParameterInfo()
Overrides:
getParameterInfo in class java.applet.Applet

paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class java.awt.Container

setDiameter

public void setDiameter(int _diameter)
Sets the diameter of the bulb. Using zero results in the bulb size being set to fill the display area. The stopcock is set to the closed state.
Parameters:
_diameter - diameter in pixels of the bulb

setGasColor

public void setGasColor(java.lang.String _color)
Sets the color of the gas in the bulb.
Parameters:
_color - integer value used to construct color

setGasColor

public void setGasColor(int _red,
                        int _green,
                        int _blue)
Sets the color of the gas in the bulb.
Parameters:
_red - red component of the color
_green - green component of the color
_blue - blue component of the color

setLiquidColor

public void setLiquidColor(int _red,
                           int _green,
                           int _blue)
Sets the color of the liquid at the bottom of the bulb

setLiquidFraction

public void setLiquidFraction(double _fraction)
Sets the amount of liquid shown at the bottom of the bulb
Parameters:
_fraction - fraction of the total bulb volume occupied by the liquid

setShowLiquid

public void setShowLiquid(boolean _showLiquid)
Determines whether the liquid at the bottom of the bulb is shown or not.

setStopcockState

public void setStopcockState(boolean _state)
Sets the state of the stopcock. If true, the stopcock is open. If false the stopcock is closed.

Chemistry Applets

David N. Blauch