Class AwtPduViewer

  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended byjava.applet.Applet
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.event.ItemListener, java.awt.MenuContainer, java.lang.Runnable,

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

AwtPduViewer is an applet that reads Pdus and displays their values on the screen. It is configured with a socket, which allows the applet to read data from the wire; it uses the package, which implements the DIS protocol.

This file was generated by Microsquish J++, which is something of an experiment. We'll see how it works out. It's also my first applet that isn't completely trivial, so be a little gentle.

This is compliant with the JDK 1.02 spec; it makes use of deprecated aspects of that API rather than use JDK 1.1. This is primarily to get it working with Netscape 3.01. 1.1 browser implementations should be compatible, at least for the next release.

Netscape bitches & moans about doing a thread.suspend(), complaining about the possibility of deadlock. Not sure what this is all about, but it seems to work. (Note: JavaSoft has deprecated thread.suspend() and friends in 1.1 because of inherent problems w/ deadlock. This needs to be reworked.

This takes two parameters from the HTML file, "PduSocket" and"MulticastGroup". The first is the socket the applet listens on. The second is a multicast group, a feature that is not implemented right now since Netscape doesn't do multicast.

Testing: sent ESPdus to host (madison) from both madison and pinafore using HISTORY

10Apr97 DMcG New

Don McGregor (

See Also:
UpdateThread, TextAreaStream, Serialized Form

Nested Class Summary
Nested classes inherited from class java.applet.Applet
Nested classes inherited from class java.awt.Panel
Nested classes inherited from class java.awt.Container
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
Field Summary
Fields inherited from class java.applet.Applet
Fields inherited from class java.awt.Container
Fields inherited from class java.awt.Component
Fields inherited from interface java.awt.image.ImageObserver
Constructor Summary
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Handles button presses
 void destroy()
 java.lang.String getAppletInfo()
 java.lang.String[][] getParameterInfo()
 void init()
          Applet initialization code
 void itemStateChanged(java.awt.event.ItemEvent ie)
          itemStateChanged is the interface for ItemListener.
 void paint(java.awt.Graphics g)
 void run()
 void start()
 void stop()
 void updateDisplay()
          Updates the display by querying the BehaviorStreamBufferUDP, returning any Pdus that have arrived since the last time we asked, and updating the display.
Methods inherited from class java.applet.Applet
getAccessibleContext, getAppletContext, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus
Methods inherited from class java.awt.Panel
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, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, 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, 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, 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, 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, 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, setName, 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


public AwtPduViewer()
Method Detail


public java.lang.String getAppletInfo()


public java.lang.String[][] getParameterInfo()


public void init()
Applet initialization code


public void actionPerformed(java.awt.event.ActionEvent e)
Handles button presses

Specified by:
actionPerformed in interface java.awt.event.ActionListener


public void destroy()


public void paint(java.awt.Graphics g)


public void start()


public void stop()


public void run()
Specified by:
run in interface java.lang.Runnable


public void updateDisplay()
Updates the display by querying the BehaviorStreamBufferUDP, returning any Pdus that have arrived since the last time we asked, and updating the display. This is kicked off by its own thread, so it runs asyncronously from the app. the display is updated every X seconds. We need to lock access to pduPool, since this is global data used elsewhere in the applet in another thread. Not sure about the requirement to lock list, the GUI element that displays the scrolling list. This is the only place we do a _write_ to it, so I think it's OK.


public void itemStateChanged(java.awt.event.ItemEvent ie)
itemStateChanged is the interface for ItemListener. When this object is added as a listener to an object, such as a awt.List, this gets the event when something is selected. We act on that by dumping out the contents of the selected item.

Specified by:
itemStateChanged in interface java.awt.event.ItemListener