The “getAppletContext().getApplets()” method will return an “Enumeration” object which contains all the loaded Applets on a page.

Example

This example contains a button, after clicked, it will list out all Applets on a page, and display in the text area line by line.

package com.mkyong.applet;
 
import java.applet.Applet;
import java.awt.Button;
import java.awt.TextArea;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Enumeration;
 
public class AppletExample1 extends Applet implements ActionListener {
 
	Button button;
	TextArea textBox;
 
	public void init(){
		button = new Button("List All applets Name");
		button.setActionCommand("CHANGEME");
		button.addActionListener(this);
		add(button);
 
     	        textBox = new TextArea(5,40);
	        add(textBox);
	}
 
	@Override
	public void actionPerformed(ActionEvent e) {
		if(e.getActionCommand().equals("CHANGEME")){
 
		    Enumeration applets = getAppletContext().getApplets();
 
		    while (applets.hasMoreElements()) {
 
		        Applet applet = (Applet)applets.nextElement();
		        String info = ((Applet)applet).getAppletInfo();
			textBox.append("- " + applet.getClass().getName() + "\n");
 
		    }
		}
	}
}
Any Java questions or problems? please post at this JavaNullPointer.com forum, see you there ~