home *** CD-ROM | disk | FTP | other *** search
/ Komputer for Alle 2003 #5 / K-CD-5-2003.ISO / Layout / data1.cab / Internet_Extensions / Java / SerifMarquee / AnimationEvent.class (.txt) < prev    next >
Encoding:
Java Class File  |  2002-07-29  |  2.0 KB  |  57 lines

  1. import java.awt.Color;
  2. import java.awt.Component;
  3. import java.awt.Graphics;
  4. import java.util.StringTokenizer;
  5.  
  6. public abstract class AnimationEvent {
  7.    public long m_speed;
  8.    public long m_xOffset;
  9.    public Animation m_animation;
  10.    public Component m_component;
  11.    Color m_colour;
  12.    String m_url;
  13.    public AnimationEvent m_next;
  14.    public AnimationEvent m_prev;
  15.  
  16.    public abstract void drawFrame(Graphics var1);
  17.  
  18.    public AnimationEvent(Component component, Animation anim) {
  19.       this.m_animation = anim;
  20.       this.m_component = component;
  21.       this.m_xOffset = 0L;
  22.       this.m_speed = 0L;
  23.       this.m_url = new String();
  24.       this.m_next = null;
  25.       this.m_prev = null;
  26.    }
  27.  
  28.    public void initFromParams(String params) {
  29.       StringTokenizer st = new StringTokenizer(params, ";");
  30.       String szToken = st.nextToken();
  31.       int nColon = szToken.indexOf(58);
  32.  
  33.       while(st.hasMoreTokens()) {
  34.          szToken = st.nextToken();
  35.          nColon = szToken.indexOf(58);
  36.          if (nColon != -1) {
  37.             String szName = szToken.substring(0, nColon).toUpperCase();
  38.             String szValue = szToken.substring(nColon + 1);
  39.             if (szName.equals("SPEED")) {
  40.                this.m_speed = 20L * Integer.valueOf(szValue).longValue() * 16L / (long)this.m_animation.m_fps;
  41.             } else if (szName.equals("COLOUR")) {
  42.                this.m_colour = Misc.initColour(szValue);
  43.             } else if (szName.equals("URL")) {
  44.                this.m_url = szValue;
  45.             }
  46.          }
  47.       }
  48.  
  49.    }
  50.  
  51.    public abstract String getUrl(int var1, int var2);
  52.  
  53.    public void incFrame() {
  54.       this.m_xOffset += this.m_speed;
  55.    }
  56. }
  57.