/* "HiddenIncubus.java" (created 2/29/96) */
/* Java Applet, revive the hidden incubus */
import java.applet.Applet;
import java.awt.*;
public class HiddenIncubus extends java.applet.Applet {
/* incubus head Rectangle (oval) */
Rectangle incubusHead_Rectangle;
/* human or incubus flag (initially human/false) */
boolean humanIncubus_Flg = false; /* human = false; incubus = true */
/* methods invoked by Java */
/* "init()"
* initialize the applet */
public void init()
{
/* 150 X 200 canvas */
resize(150,200);
/* init the incubus head Rectangle (oval) */
incubusHead_Rectangle = new Rectangle(37,66,76,129);
} /* end method "init" */
/* "paint()"
* paint the screen */
public void paint(Graphics g)
{
/* fill the entire canvas with white paint */
g.setColor(Color.white);
g.fillRect(0,0,150,200);
g.setColor(Color.black);
/* draw the incubus */
Draw_Incubus(g);
} /* end method "paint" */
/* "handleEvent()"
* handle events */
public boolean handleEvent(Event theEvent) {
Graphics g;
switch (theEvent.id) {
case Event.MOUSE_MOVE:
case Event.MOUSE_DRAG:
/* make incubus (?) */
if ( (humanIncubus_Flg == false) &&
(incubusHead_Rectangle.inside(theEvent.x,theEvent.y)) ) {
g = getGraphics();
/* flag incubus */
humanIncubus_Flg = true;
/* draw the incubus */
Draw_Incubus(g);
} /* end "if ( (humanIncubus_Flg == false) &&..." */
/* make human (?) */
else if ( (humanIncubus_Flg == true) &&
(! incubusHead_Rectangle.inside(theEvent.x,theEvent.y))
) {
g = getGraphics();
/* flag human */
humanIncubus_Flg = false;
/* draw the incubus */
Draw_Incubus(g);
} /* end "else if ( (humanIncubus_Flg == true) &&..." */
return true; /* break MOUSE_MOVE:MOUSE_DRAG */
default:
return false;
} /* end "switch (theEvent.id)" */
} /* end method "handleEvent" */
/* "Draw_Incubus()"
* draw the incubus */
public void Draw_Incubus(Graphics g) {
/* incubus head (?) */
if (humanIncubus_Flg == true) {
/* draw incubus left horn */
g.setColor(Color.black);
g.drawRect(incubusHead_Rectangle.x + 9,5,13,incubusHead_Rectangle.y + 18);
/* draw incubus (right) horn */
g.drawRect ( incubusHead_Rectangle.x+(incubusHead_Rectangle.width-22),5,
13,incubusHead_Rectangle.y + 18);
/* fill incubus head */
g.setColor(Color.red);
g.fillOval ( incubusHead_Rectangle.x,incubusHead_Rectangle.y,
incubusHead_Rectangle.width,incubusHead_Rectangle.height );
/* fill incubus eye (left) with white paint */
g.setColor(Color.white);
g.fillOval(incubusHead_Rectangle.x + 9,100,25,25);
/* fill incubus eye (right) with white paint */
g.fillOval (
incubusHead_Rectangle.x + (incubusHead_Rectangle.width - 34),100,25,25 );
/* draw incubus pupil (left) */
g.setColor(Color.black);
g.fillOval(incubusHead_Rectangle.x + 15,113,13,13);
/* draw incubus pupil (right) */
g.fillOval (
incubusHead_Rectangle.x + (incubusHead_Rectangle.width - 28),113,13,13);
} /* end "if (humanIncubus_Flg == true)" */
/* human head (?) */
else if (humanIncubus_Flg == false) {
/* fill incubus (left) horn (erase to white) */
g.setColor(Color.white);
g.fillRect(incubusHead_Rectangle.x + 9,5,14,incubusHead_Rectangle.y + 19);
/* fill incubus (right) horn (erase to white) */
g.fillRect ( incubusHead_Rectangle.x+(incubusHead_Rectangle.width-22),5,
14,incubusHead_Rectangle.y + 19);
/* fill the incubus head (oval) */
g.setColor(Color.white);
g.fillOval ( incubusHead_Rectangle.x,incubusHead_Rectangle.y,
incubusHead_Rectangle.width,incubusHead_Rectangle.height );
/* fill human pupil (left) */
g.setColor(Color.black);
g.fillOval(incubusHead_Rectangle.x + 19,111,6,6);
/* fill human pupil (right) */
g.fillOval (
incubusHead_Rectangle.x+(incubusHead_Rectangle.width - 24),111,6,6);
} /* end "else if (humanIncubus_Flg == false)" */
/* draw head (oval) outline */
g.drawOval ( incubusHead_Rectangle.x,incubusHead_Rectangle.y,
incubusHead_Rectangle.width,incubusHead_Rectangle.height );
/* draw eye (left) outline */
g.drawOval(incubusHead_Rectangle.x + 9,100,25,25);
/* draw eye (right) outline */
g.drawOval (
incubusHead_Rectangle.x + (incubusHead_Rectangle.width - 34),100,25,25 );
/* incubus head (?) */
if (humanIncubus_Flg == true) {
/* fill incubus (left) horn */
g.setColor(Color.red);
g.fillRect(incubusHead_Rectangle.x + 10,6,12,incubusHead_Rectangle.y + 17);
/* fill incubus (right) horn */
g.fillRect ( incubusHead_Rectangle.x+(incubusHead_Rectangle.width-21),6,
12,incubusHead_Rectangle.y + 17);
} /* end "if (humanIncubus_Flg == true)" */
} /* end method "Draw_Incubus" */
} /* end class "HiddenIncubus" */
/* end file "HiddenIncubus.java" */
[return]