Cramfull Compiled Resources v2.00
Class ResourceViewer

All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, java.awt.image.ImageObserver, java.awt.event.ItemListener, java.awt.MenuContainer, java.awt.event.MouseListener,, java.awt.event.WindowListener

public class ResourceViewer
extends java.applet.Applet
implements java.awt.event.WindowListener, java.awt.event.MouseListener, java.awt.event.ItemListener

Utility class to view, list or dump the resources contained by compiler Cramfull subclasses.

We supply this class as a free service to all users of the Cramfull Compiled Resources library. You are allowed to modify this source code, provided you move the class out of the be.arci package hierarchy.

ResourceViewer plays audio files and views images and animated images. ResourceViewer also displays .properties files as a list of key = value pairs, either for a single .properties resource or for a locale hierarchy of .properties resources, and deserializes stored objects. Other resource types are displayed in hex byte and ASCII format.

You can use ResourceViewer as applet or as an application.

As an applet

These are the possible applet parameters:
a qualified Java class name of the Cramfull subclass, e.g. ""
If true, ResourceViewer loads a single instance using the exact name of the resources parameter. By default ResourceViewer loads a locale-hierarchy using ResourceBundle.getBundle(), with the resources parameter as base name
Locale to use with ResourceBundle.getBundle() (e.g. _fr_CA or _nl_BE_EURO, default getDefaultLocale())
If true, ResourceViewer zooms in on small images
The number of hex bytes to display for unhandled resource types (default 480)


<APPLET WIDTH=700 HEIGHT=400> <PARAM NAME=resources> <PARAM NAME=single VALUE=true> <PARAM NAME=hexbytes VALUE=640> <PARAM NAME=zoom VALUE=true> </APPLET>

As an application

The equivalent command-line parameters are

java [arguments]


Cramfull subclass; escape leading '-' in the classname with a leading '--'
Single instance (see Applet)
Locale for getBundle() (see Applet)
Zoom (see Applet)
Number of hex bytes (see Applet)
List all resources in a single instance or getBundle hierarchy
Sets debug mode: list all resources collected from a class file.
Dump all contained resources (wether loaded as single instance or as locale-hierarchy) to the local file system, creating any necessary directories starting from the (existing) directory BaseDir.
The above dump runs in overwrite mode

See Also:
Cramfull, Serialized Form

Inner classes inherited from class java.applet.Applet
Inner classes inherited from class java.awt.Panel
Inner classes inherited from class java.awt.Container
Inner classes inherited from class java.awt.Component
Fields inherited from class java.awt.Component
Constructor Summary
Method Summary
protected  void checkContents()
          View list of resources or dump them all to local file system
 java.lang.String[][] getParameterInfo()
 void init()
 void itemStateChanged(java.awt.event.ItemEvent e)
static void main(java.lang.String[] args)
          Runs ResourceViewer as an application
 void mouseClicked(java.awt.event.MouseEvent me)
 void mouseEntered(java.awt.event.MouseEvent e)
 void mouseExited(java.awt.event.MouseEvent e)
 void mousePressed(java.awt.event.MouseEvent e)
 void mouseReleased(java.awt.event.MouseEvent e)
 void showResource(java.lang.String sResource)
          Displays current resource (current item in lstResources) in pnlResource, depending on it's MIME type or it's resource name.
 void sort(java.awt.List lst)
          Simple sort routine for small collections
 void windowActivated(java.awt.event.WindowEvent e)
 void windowClosed(java.awt.event.WindowEvent e)
 void windowClosing(java.awt.event.WindowEvent we)
 void windowDeactivated(java.awt.event.WindowEvent e)
 void windowDeiconified(java.awt.event.WindowEvent e)
 void windowIconified(java.awt.event.WindowEvent e)
 void windowOpened(java.awt.event.WindowEvent e)
Methods inherited from class java.applet.Applet
destroy, getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop
Methods inherited from class java.awt.Panel
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, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, 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, addHierarchyBoundsListener, addHierarchyListener, 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, getGraphicsConfiguration, 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, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, 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


public ResourceViewer()
Method Detail


public static void main(java.lang.String[] args)
Runs ResourceViewer as an application


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


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


public void itemStateChanged(java.awt.event.ItemEvent e)
Specified by:
itemStateChanged in interface java.awt.event.ItemListener


public void windowDeactivated(java.awt.event.WindowEvent e)
Specified by:
windowDeactivated in interface java.awt.event.WindowListener


public void windowClosing(java.awt.event.WindowEvent we)
Specified by:
windowClosing in interface java.awt.event.WindowListener


public void windowOpened(java.awt.event.WindowEvent e)
Specified by:
windowOpened in interface java.awt.event.WindowListener


public void windowClosed(java.awt.event.WindowEvent e)
Specified by:
windowClosed in interface java.awt.event.WindowListener


public void windowDeiconified(java.awt.event.WindowEvent e)
Specified by:
windowDeiconified in interface java.awt.event.WindowListener


public void windowActivated(java.awt.event.WindowEvent e)
Specified by:
windowActivated in interface java.awt.event.WindowListener


public void windowIconified(java.awt.event.WindowEvent e)
Specified by:
windowIconified in interface java.awt.event.WindowListener


public void mouseClicked(java.awt.event.MouseEvent me)
Specified by:
mouseClicked in interface java.awt.event.MouseListener


public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener


public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener


public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener


public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener


protected void checkContents()
View list of resources or dump them all to local file system


public void showResource(java.lang.String sResource)
Displays current resource (current item in lstResources) in pnlResource, depending on it's MIME type or it's resource name.
  1. If the MIME type starts with "audio/", we play an AudioClip.
  2. If the MIME type starts with "image/", we display an Image.
  3. If the resource name starts with SERIALIZED_TAG, we display a deserialized Object.
  4. If the resource name ends with .properties, and contains an underscore ('_'), we load a set of Properties objects
  5. If the resource name ends with .properties, and does not contain an underscore ('_'), we load a locale hierarchy of Properties objects with the resource name (.properties suffix truncated) as base name.
  6. For other resources, we display the first n hexadecimal bytes side by side with their ASCII character value.

sResource - current resource name
See Also:


public void sort(java.awt.List lst)
Simple sort routine for small collections

Cramfull Compiled Resources v2.00