Modern Java
http://www.modernminds.com
W ildNews Demo

The WildNews example applet is the electronic equivalent of a newspaper story. The news story is "typed" onto the screen in typewriter fashion, while photographs related to the story are automatically displayed at the appropriate point in the story's text. The caption text for each photo is also updated automatically whenever the photo changes.

A pplet Tag

The applet tag for the WildNews applet is shown below.

<APPLET CODEBASE="../../Java"
  WIDTH="244" HEIGHT="174"
  CODE="WildViewApplet.class">
<PARAM NAME="loadMsg"
  VALUE="Loading news story...">
<PARAM NAME="color"VALUE="E5E5E5">
<PARAM NAME="panelSet1"
  VALUE="DocExamples/WildNews/WildNewsStory.TXT">
</APPLET>
P anel Set File

The panel set file used by the WildBackground applet is shown below.

<PANEL name=headline module="WVPanelText"
  x=104 y=4 w=130 h=22
  background=F5F5F5 fontColor=FF0000
  fontSize=14 fontStyle=bold justify=center>

<PANEL name=photo module="WVPanelImage"
  x=4 y=4 w=90 h=120
  loadTrigger=article
  image="DocExamples/WildNews/WildStoryPhotos.JPG"
  displayX=0 displayY=0 displayW=90 displayH=120>

<PANEL name=caption module="WVPanelText"
  x=4 y=128 w=90 h=42
  background=F5F5F5 fontSize=10 fontColor=FF0000
  fontStyle=italic justify=center>

<PANEL name=article module="WVPanelTypewriter"
  x=104 y=30 w=135 h=140 clock=25
  charclock=50 fontSize=14 fontColor=000000
  leading=-2 initWait=photo pause=enter
  mouseX=0 mouseY=0 mouseW=244 mouseH=174>

<TRIGGER panel=headline text="Young Heroes">
<TRIGGER panel=photo displayX=0 displayY=0
  displayW=90 displayH=120>
<TRIGGER panel=caption text="The Four Young
  Heroes After Soccer Practice">

VERDAD, COLORADO - Four young children are heroes today after performing an amazing rescue on their way home from soccer practice.<P>

John Thompson (age 8), his brothers Ted and Sam (ages 9 and 7), and his sister Sue (age 6) had just finished practicing with their soccer team in Wild Oaks park when John, who was in front of the group and leading the way home, saw something unusual.<P>

<TRIGGER panel=photo displayX=90 displayY=0
  displayW=90 displayH=120>
<TRIGGER panel=caption text="The Endangered Calf
  in Verdad, Colorado">

There in front of him, in the middle of the road, was a young calf quivering in fear.<P>

John stopped short and quickly looked around to see what could be causing the calf such anxiety. Suddenly he saw something orange move behind the bush that bordered the edge of the road.<P>

Silently and warily, John approached the bush. As he drew within ten feet, suddenly a

<TRIGGER panel=photo displayX=180 displayY=0
  displayW=90 displayH=120>
<TRIGGER panel=caption text="The Dangerous
  Leopard at Large">

leopard jumped clear and sprinted for the calf. John cried out and stumbled backwards away from the leopard who quickly was within feet of the poor calf.<P>

John knew what he had to do. He dropped his soccer ball in front of him and gave it the hardest kick he could muster. The ball flew a steady course and hit the leopard square in the head. The leopard stood motionless for a moment, dazed by the force of the blow.<P>

John scampered quickly to reclaim the ball and began calling for help.<P>

His brothers and sister came running just as he dropped the ball for a second time and gave it another good kick. Once again the ball connected solidly with the leopard's head and the leopard now began to stumble a bit.<P>

Shaking his head, the leopard turned his somewhat dazed and vacant gaze toward the group of small children.<P>

<TRIGGER panel=photo displayX=0 displayY=0
  displayW=90 displayH=120>
<TRIGGER panel=caption text="The Four
  Youngsters in Peril">

Without a word, the rest of the children, imitating their brother, quickly began to pummel the leopard relentlessly with soccer balls.<P>

The calf seeing that the leopard had, for the time being, lost interest in attacking, ran from the road away into the meadow.<P>

The children continued their attack until the leopard ceased to move.<P>

After the children returned home and told their

<TRIGGER panel=photo displayX=270 displayY=0
  displayW=90 displayH=120>
<TRIGGER panel=caption text="The Grandparents
  Preparing Leopard Stew">

grandparents their story, the family drove to the location where the attack had occurred and found that the constant barrage of soccer balls had been too much for the leopard to withstand.<P>

<TRIGGER panel=photo displayX=90 displayY=0
  displayW=90 displayH=120>
<TRIGGER panel=caption text="The New Pet Calf">

The calf was unharmed and has now become a pet of the four children.

Notice that the "loadTrigger" attribute is used in the "photo" panel definition. The "loadTrigger" attribute tells the image panel to send a message to the "article" panel once the image has been completely loaded.

The trigger is used by the "article" panel to start the article text display once the "photo" image has been completely loaded.

The <TRIGGER> tags are embedded in the text in order to change the photo and caption when specific points in the text are reached.

Notice that the mouse area for the "article" panel is defined to cover the entire applet area instead of just the panel's display area. This is done so that the text will pause whenever the mouse enters the applet instead of pausing only when the mouse enters the "article" panel within the applet.
I mage File

The image file used by the WildNews applet is shown below.

WildStoryPhotos.JPG
Copyright © 1997 by Modern Minds, Inc.