home *** CD-ROM | disk | FTP | other *** search
- DEF_COMPONENTNAME
- Animation
- DEF_SUPERCLASS
- Panel
- DEF_SUPERCOMPONENT
-
- DEF_PACKAGE
- mojo
- animation
- DEF_ENDLIST
- DEF_SUBCOMPONENTLIST
- DEF_ENDLIST
- DEF_SUBCOMPONENTCLASSLIST
- DEF_ENDLIST
- DEF_CATEGORY
- Animation
- DEF_BITMAP
-
- DEF_THUMBNAIL_UP
- anim2.bmp
- DEF_THUMBNAIL_DOWN
- 2-anim2.bmp
- DEF_VISUAL
- DEF_TOOL
- DEF_PANEL
- DEF_IMPORTS
- DEF_ENDLIST
- DEF_REQUIRES
- FrameChanger
- DEF_ENDLIST
- DEF_IMPLEMENTS
- DEF_ENDLIST
- DEF_DECLARATION
- // an animation panel component.
-
- String prefix; // animation file prefix
- int numberOfFrames; // number of frames of animation
- int delay; // delay in milliseconds between frames
- int startFrame;
- int endFrame;
-
- java.awt.Image frame[];
- int currentFrame;
-
- FrameChanger frameChanger;
-
- DEF_ENDLIST
- DEF_METHOD
- public void changeFrames()
- // moves to the next frame in the animation seuqence.
- {
- currentFrame++;
- if (currentFrame > endFrame)
- currentFrame = startFrame;
- repaint();
- }
- DEF_ENDLIST
- DEF_METHOD
- public void paint(Graphics g)
- // draw the current frame
- {
- if (frame == null) {
- // frames are not loaded to load them
- frame = new java.awt.Image[numberOfFrames + 1];
-
- currentFrame = startFrame;
-
- for (int i = 1; i <= numberOfFrames; i++) {
- frame[i] = applet.getImage(applet.getCodeBase(),
- prefix + Integer.toString(i)
- + ".gif");
- }
-
- // load the frame changer and start the animation
-
- // use the default FrameChanger constructor
- frameChanger = new FrameChanger();
-
- frameChanger.setAnimationDelay(delay);
- frameChanger.setAnimationComponent(this);
-
- // start the frame changer
- frameChanger.start();
- }
-
- g.drawImage(frame[currentFrame], 0, 0, this);
- }
- DEF_ENDLIST
- DEF_METHOD
- public void gotoFrame(int framenumber)
- // goes to the specified frame.
- // if framenumber is > numberOfFrames, framenumber will be set to max frames
- // if framenubmer is < 1, the framenumber is set to 1.
- // only perform the operation if the Animation is paused.
- {
- if (frameChanger.isPaused() == true) {
- if (framenumber > numberOfFrames)
- currentFrame = numberOfFrames;
- else
- if (framenumber < 1)
- currentFrame = 1;
- else
- currentFrame = framenumber;
- }
- }
- DEF_ENDLIST
- DEF_METHOD
- public void nextFrame()
- // goes to the next frame in the animation.
- // if framenumber is > numberOfFrames, framenumber will be the max frames
- // only perform the operation if the Animation is paused.
- {
- if (frameChanger.isPaused() == true) {
- currentFrame--;
- if (currentFrame < 1)
- currentFrame = 1;
- repaint();
- }
- }
- DEF_ENDLIST
- DEF_METHOD
- public void prevFrame()
- // goes to the previous frame in the animation.
- // if framenumber is < 1, framenumber will be set to the first frame 1.
- // only perform the operation if the Animation is paused.
- {
- if (frameChanger.isPaused() == true) {
- currentFrame++;
- if (currentFrame > numberOfFrames)
- currentFrame = numberOfFrames;
- repaint();
- }
- }
- DEF_ENDLIST
- DEF_METHOD
- public void pause()
- // pauses the animation.
- {
- frameChanger.pause();
- }
- DEF_ENDLIST
- DEF_METHOD
- public void play()
- // starts an animation.
- {
- frameChanger.play();
- }
- DEF_ENDLIST
- DEF_METHOD
- public void setDelay(int duration)
- {
- delay = duration;
- }
- DEF_ENDLIST
- DEF_METHOD
- public int getDelay()
- {
- return(delay);
- }
- DEF_ENDLIST
- DEF_METHOD
- public void setNumberFrames(int numframes)
- {
- numberOfFrames = numframes;
- }
- DEF_ENDLIST
- DEF_METHOD
- public int getNumberFrames()
- {
- return(numberOfFrames);
- }
- DEF_ENDLIST
- DEF_METHOD
- public void setStartFrame(int frame)
- {
- startFrame = frame;
- }
- DEF_ENDLIST
- DEF_METHOD
- public int getStartFrame()
- {
- return(startFrame);
- }
- DEF_ENDLIST
- DEF_METHOD
- public void setEndFrame(int frame)
- {
- endFrame = frame;
- }
- DEF_ENDLIST
- DEF_METHOD
- public int getEndFrame()
- {
- return(endFrame);
- }
- DEF_ENDLIST
- DEF_METHOD
- public void setPrefix(String fileprefix)
- {
- prefix = fileprefix;
- }
- DEF_ENDLIST
- DEF_METHOD
- public String getPrefix()
- {
- return(prefix);
- }
- DEF_ENDLIST
- DEF_PROPERTY
- First Animation Frame
- ANIMATION_FILENAME
- setPrefix(AVALUE);
- AVALUE = getPrefix();
-
- DEF_ENDLIST
- DEF_PROPERTY
- Number of Frames
- int
- setNumberFrames(AVALUE);
- AVALUE = getNumberFrames();
- 0
- DEF_ENDLIST
- DEF_PROPERTY
- Start Frame
- int
- setStartFrame(AVALUE);
- AVALUE = getStartFrame();
- 0
- DEF_ENDLIST
- DEF_PROPERTY
- End Frame
- int
- setEndFrame(AVALUE);
- AVALUE = getEndFrame();
- 0
- DEF_ENDLIST
- DEF_PROPERTY
- Delay (in milliseconds)
- int
- setDelay(AVALUE);
- AVALUE = getDelay();
- 0
- DEF_ENDLIST
- DEF_PROPERTY
- Top
- int
- move(bounds().x, AVALUE);
- AVALUE = bounds().y;
- 0
- DEF_ENDLIST
- DEF_PROPERTY
- Left
- int
- move(AVALUE, bounds().y);
- AVALUE = bounds().x;
- 0
- DEF_ENDLIST
- DEF_PROPERTY
- Height
- int
- resize(bounds().width, AVALUE);
- AVALUE = bounds().height;
- 100
- DEF_ENDLIST
- DEF_PROPERTY
- Width
- int
- resize(AVALUE, bounds().height);
- AVALUE = bounds().width;
- 100
- DEF_ENDLIST
- DEF_PROPERTY
- ForegroundColor
- Color
- setForeground(AVALUE);
- AVALUE = getForeground();
- Color.lightGray
- DEF_ENDLIST
- DEF_PROPERTY
- BackgroundColor
- Color
- setBackground(AVALUE);
- AVALUE = getBackground();
- Color.lightGray
- DEF_ENDLIST
- DEF_PROPERTY
- FontName
- String
- setFont(new Font(AVALUE, getFont().getStyle(), getFont().getSize()));
- AVALUE = getFont().getName();
- Courier
- DEF_ENDLIST
- DEF_PROPERTY
- FontStyle
- int
- setFont(new Font(getFont().getName(), AVALUE, getFont().getSize()));
- AVALUE = getFont().getStyle();
- Font.PLAIN
- DEF_ENDLIST
- DEF_PROPERTY
- FontSize
- int
- setFont(new Font(getFont().getName(), getFont().getStyle(), AVALUE));
- AVALUE = getFont().getSize();
- 10
- DEF_ENDLIST
- DEF_ENDCOMPONENT
- DEF_COMPONENTNAME
- FrameChanger
- DEF_SUPERCLASS
- Thread
- DEF_SUPERCOMPONENT
-
- DEF_PACKAGE
- mojo
- animation
- DEF_ENDLIST
- DEF_SUBCOMPONENTLIST
- DEF_ENDLIST
- DEF_SUBCOMPONENTCLASSLIST
- DEF_ENDLIST
- DEF_CATEGORY
-
- DEF_BITMAP
-
- DEF_THUMBNAIL_UP
-
- DEF_THUMBNAIL_DOWN
-
- DEF_IMPORTS
- DEF_ENDLIST
- DEF_REQUIRES
- DEF_ENDLIST
- DEF_IMPLEMENTS
- DEF_ENDLIST
- DEF_DECLARATION
- // Thread Control to change frames in an animation.
- // Requires the animation component.
-
- Animation animation;
- int delay;
- boolean paused = false;
- DEF_ENDLIST
- DEF_METHOD
- public void setAnimationComponent(Animation anime)
- // sets the frame changers animation component.
- {
- animation = anime;
- }
- DEF_ENDLIST
- DEF_METHOD
- public void setAnimationDelay(int duration)
- // sets the frame changers animation delay in milliseconds.
- {
- delay = duration;
- }
- DEF_ENDLIST
- DEF_METHOD
- public void pause()
- // pauses the animation.
- {
- paused = true;
- }
- DEF_ENDLIST
- DEF_METHOD
- public void play()
- // start the animation running.
- {
- paused = false;
- }
- DEF_ENDLIST
- DEF_METHOD
- public boolean isPaused()
- // returns whether the animation is paused or not.
- {
- return(paused);
- }
- DEF_ENDLIST
- DEF_METHOD
- public void run()
- // change frames on the animation
- {
- while (true) {
- if (animation != null) {
- if (paused == false)
- animation.changeFrames();
- try { Thread.sleep(delay); } catch (InterruptedException e) { break; };
- }
- }
- }
- DEF_ENDLIST
- DEF_ENDCOMPONENT
- DEF_COMPONENTNAME
- Picture
- DEF_SUPERCLASS
- Panel
- DEF_SUPERCOMPONENT
-
- DEF_PACKAGE
- mojo
- awt
- DEF_ENDLIST
- DEF_SUBCOMPONENTLIST
- DEF_ENDLIST
- DEF_SUBCOMPONENTCLASSLIST
- DEF_ENDLIST
- DEF_CATEGORY
- Standard
- DEF_BITMAP
-
- DEF_THUMBNAIL_UP
- pict.bmp
- DEF_THUMBNAIL_DOWN
- 2-pict.bmp
- DEF_VISUAL
- DEF_TOOL
- DEF_PANEL
- DEF_IMPORTS
- DEF_ENDLIST
- DEF_REQUIRES
- DEF_ENDLIST
- DEF_IMPLEMENTS
- DEF_ENDLIST
- DEF_DECLARATION
- // A Picture Image class. This produces a generic Image.
-
- java.awt.Image image;
- String filename;
- DEF_ENDLIST
- DEF_METHOD
- public String getFileName()
- // returns the filename instance variable
- {
- return (filename);
- }
- DEF_ENDLIST
- DEF_METHOD
- public void setFileName(String aFileName)
- {
- filename = aFileName;
- image = null;
- }
- DEF_ENDLIST
- DEF_METHOD
- public void paint(Graphics g)
- // draw the current frame
- {
- if (image == null) {
- image = applet.getImage(applet.getCodeBase(), filename);
- }
- g.drawImage(image, 0, 0, this);
- }
- DEF_ENDLIST
- DEF_PROPERTY
- Filename
- GIF_FILENAME
- setFileName(AVALUE);
- AVALUE = getFileName();
-
- DEF_ENDLIST
- DEF_PROPERTY
- Top
- int
- move(bounds().x, AVALUE);
- AVALUE = bounds().y;
- 0
- DEF_ENDLIST
- DEF_PROPERTY
- Left
- int
- move(AVALUE, bounds().y);
- AVALUE = bounds().x;
- 0
- DEF_ENDLIST
- DEF_PROPERTY
- Height
- int
- resize(bounds().width, AVALUE);
- AVALUE = bounds().height;
- 100
- DEF_ENDLIST
- DEF_PROPERTY
- Width
- int
- resize(AVALUE, bounds().height);
- AVALUE = bounds().width;
- 100
- DEF_ENDLIST
- DEF_PROPERTY
- ForegroundColor
- Color
- setForeground(AVALUE);
- AVALUE = getForeground();
- Color.lightGray
- DEF_ENDLIST
- DEF_PROPERTY
- BackgroundColor
- Color
- setBackground(AVALUE);
- AVALUE = getBackground();
- Color.lightGray
- DEF_ENDLIST
- DEF_PROPERTY
- FontName
- String
- setFont(new Font(AVALUE, getFont().getStyle(), getFont().getSize()));
- AVALUE = getFont().getName();
- Courier
- DEF_ENDLIST
- DEF_PROPERTY
- FontStyle
- int
- setFont(new Font(getFont().getName(), AVALUE, getFont().getSize()));
- AVALUE = getFont().getStyle();
- Font.PLAIN
- DEF_ENDLIST
- DEF_PROPERTY
- FontSize
- int
- setFont(new Font(getFont().getName(), getFont().getStyle(), AVALUE));
- AVALUE = getFont().getSize();
- 10
- DEF_ENDLIST
- DEF_ENDCOMPONENT
- DEF_COMPONENTNAME
- Screen
- DEF_SUPERCLASS
- Panel
- DEF_SUPERCOMPONENT
-
- DEF_PACKAGE
- mojo
- awt
- DEF_ENDLIST
- DEF_SUBCOMPONENTLIST
- DEF_ENDLIST
- DEF_SUBCOMPONENTCLASSLIST
- DEF_ENDLIST
- DEF_CATEGORY
-
- DEF_BITMAP
-
- DEF_THUMBNAIL_UP
-
- DEF_THUMBNAIL_DOWN
-
- DEF_VISUAL
- DEF_PANEL
- DEF_IMPORTS
- DEF_ENDLIST
- DEF_REQUIRES
- DEF_ENDLIST
- DEF_IMPLEMENTS
- DEF_ENDLIST
- DEF_DECLARATION
- // A Panel Container class. This produces a generic container.
- DEF_ENDLIST
- DEF_PROPERTY
- Top
- int
- move(bounds().x, AVALUE);
- AVALUE = bounds().y;
- 0
- DEF_ENDLIST
- DEF_PROPERTY
- Left
- int
- move(AVALUE, bounds().y);
- AVALUE = bounds().x;
- 0
- DEF_ENDLIST
- DEF_PROPERTY
- Height
- int
- resize(bounds().width, AVALUE);
- AVALUE = bounds().height;
- 100
- DEF_ENDLIST
- DEF_PROPERTY
- Width
- int
- resize(AVALUE, bounds().height);
- AVALUE = bounds().width;
- 100
- DEF_ENDLIST
- DEF_PROPERTY
- ForegroundColor
- Color
- setForeground(AVALUE);
- AVALUE = getForeground();
- Color.black
- DEF_ENDLIST
- DEF_PROPERTY
- BackgroundColor
- Color
- setBackground(AVALUE);
- AVALUE = getBackground();
- Color.lightGray
- DEF_ENDLIST
- DEF_PROPERTY
- FontName
- String
- setFont(new Font(AVALUE, getFont().getStyle(), getFont().getSize()));
- AVALUE = getFont().getName();
- Courier
- DEF_ENDLIST
- DEF_PROPERTY
- FontStyle
- int
- setFont(new Font(getFont().getName(), AVALUE, getFont().getSize()));
- AVALUE = getFont().getStyle();
- Font.PLAIN
- DEF_ENDLIST
- DEF_PROPERTY
- FontSize
- int
- setFont(new Font(getFont().getName(), getFont().getStyle(), AVALUE));
- AVALUE = getFont().getSize();
- 10
- DEF_ENDLIST
- DEF_ENDCOMPONENT
- DEF_COMPONENTNAME
- SoundComponent
- DEF_SUPERCLASS
- Object
- DEF_SUPERCOMPONENT
-
- DEF_PACKAGE
- mojo
- sound
- DEF_ENDLIST
- DEF_SUBCOMPONENTLIST
- DEF_ENDLIST
- DEF_SUBCOMPONENTCLASSLIST
- DEF_ENDLIST
- DEF_CATEGORY
-
- DEF_BITMAP
-
- DEF_THUMBNAIL_UP
-
- DEF_THUMBNAIL_DOWN
-
- DEF_IMPORTS
- DEF_ENDLIST
- DEF_REQUIRES
- DEF_ENDLIST
- DEF_IMPLEMENTS
- DEF_ENDLIST
- DEF_DECLARATION
- DEF_ENDLIST
- DEF_METHOD
- public void playSound(String filename)
- {
- applet.play(applet.getCodeBase(), filename);
- }
- DEF_ENDLIST
- DEF_TASK
- Play Sound
- SoundComponent
- Multimedia
- sndbut.bmp
- public void playSound(String filename)
- DEF_ENDLIST
- DEF_ENDCOMPONENT
-