import java.awt.*;
import java.applet.*;
public class HelloWorld
extends Applet
{
public void paint(Graphics g)
{
try
g.drawString("Hello World", 25, 50);
catch (Exception e) {}
}
}
<APPLET CODEBASE=applet-url (defaults to document base) CODE=applet-filename WIDTH=pixel-width HEIGHT=pixel-height ALT=alternative-text (no applet) NAME=applet-name ALIGN=alignment (top, middle, bottom) VSPACE=vertical-pixel-space HSPACE=horizontal-pixel-space > <PARAM NAME=param-name VALUE=param-value> ... alternate-html </APPLET>
<EMBED SRC="betaclasses/Animator.class" WIDTH=80 HEIGHT=100 <PARAM NAME="imagesource" VALUE="graphics/100pixel"> <PARAM NAME="pause" VALUE="100"> </EMBED>
<applet code=MyApp.class width=300 p1=34 p2="test"> </applet>
String s = Applet.getParameter("p1");
init() start() stop() destroy()
void paint(Graphics g); void paintAll(Graphics g); void repaint(); void repaint(int x, int y, int width, int height); void repaint(long tm); void repaint(long tm, int x, int y, int width, int height); void print(Graphics g); void printAll(Graphics g); void update(Graphics g);
int checkImage(Image image, ImageObserver observer);
int checkImage(Image image, int width, int height,
ImageObserver observer);
Image createImage(ImageProducer producer);
Image createImage(int width, int height);
Rectangle bounds();
boolean imageUpdate(Image img, int flags, int x,
ImageObserver observer);
boolean prepareImage(Image image, ImageObserver observer);
prepareImage(Image image, int width, int height,
int y, int w, int h);
Color getBackground(); ColorModel getColorModel(); Font getFont(); FontMetrics getFontMetrics(Font font); Color getForeground(); Graphics getGraphics(); Container getParent(); ComponentPeer getPeer(); Toolkit getToolkit();
void setVisible(boolean); boolean isShowing(); boolean isVisible();
Component locate(int x, int y); boolean inside(int x, int y); Point location(); void move(int x, int y);
Dimension size(); Dimension minimumSize(); Dimension preferredSize(); void reshape(int x, int y, int width, int height); void resize(Dimension d); void resize(int width, int height);
boolean action(Event evt, Object what); void deliverEvent(Event evt); boolean handleEvent(Event evt); boolean mouseDown(Event evt, int x, int y); boolean mouseDrag(Event evt, int x, int y); boolean mouseEnter(Event evt, int x, int y); boolean mouseExit(Event evt, int x, int y); boolean mouseMove(Event evt, int x, int y); boolean mouseUp(Event evt, int x, int y); §1.10.46 boolean keyDown(Event evt, int key); boolean keyUp(Event evt, int key); boolean postEvent(Event evt);
boolean gotFocus(Event evt, Object what); boolean lostFocus(Event evt, Object what); void nextFocus(); void requestFocus();
void setBackground(Color c); void setFont(Font f); void setForeground(Color c);
void addNotify(); void removeNotify();
void validate(); void disable(); void enable(); void enable(boolean cond); void invalidate(); boolean isEnabled(); boolean isValid(); void layout(); void list(); void list(PrintStream out); void list(PrintStream out, int indent); String toString();
LayoutManager getLayout(); void setLayout(LayoutManager mgr);
Component add(Component comp); Component add(Component comp, int pos); Component add(String name, Component comp); Component getComponent(int n); Component[] getComponents(); int countComponents(); void remove(Component comp); void removeAll(); Component locate(int x, int y);
void paintComponents(Graphics g); void printComponents(Graphics g);
Insets insets(); Dimension minimumSize(); Dimension preferredSize(); void layout();
void deliverEvent(Event evt);
void list(PrintStream out, int indent); String paramString();
import java.applet.*; // Applet and AudioClip
import java.awt.*;
public class LoadPlay
extends Applet
{
AudioClip[] audio;
int I;
public void init()
{
I = 0;
audio = new AudioClip[2];
audio[0] = getAudioClip(getCodeBase(), "1812Overture.au");
audio[1] = getAudioClip(getCodeBase(), "FurDelise.au");
}
public void start() { audio[I].loop(); }
public void stop() { audio[I].stop(); I = (I + 1) % audio.length;}
}