import java.applet.Applet;
import java.awt.Component;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
/**
* Tests listener events on parent. This applet should
* be notified of all events on the parent, if it has
* a corresponding listener attached.
*
* @author langel at redhat dot com
*/
public class TestAppletListeners
extends Applet
implements ComponentListener
{
boolean compShown;
public void init()
{
addComponentListener(this);
triggerEvent();
}
void triggerEvent()
{
Component p = getParent();
if (p != null)
{
dispatchEvent(new ComponentEvent(p, ComponentEvent.COMPONENT_SHOWN));
if (!compShown)
System.err.println("componentShown not called!");
}
}
///////////////////////////////////
/// ComponentListener Methods /////
///////////////////////////////////
/**
* This method is called when the component is resized.
*
* @param event the ComponentEvent
indicating the resize
*/
public void componentResized(ComponentEvent event)
{
}
/**
* This method is called when the component is moved.
*
* @param event the ComponentEvent
indicating the move
*/
public void componentMoved(ComponentEvent event)
{
}
/**
* This method is called when the component is made visible.
*
* @param event the ComponentEvent
indicating the visibility
*/
public void componentShown(ComponentEvent event)
{
compShown = true;
}
/**
* This method is called when the component is hidden.
*
* @param event the ComponentEvent
indicating the visibility
*/
public void componentHidden(ComponentEvent event)
{
}
}