home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-08-14 | 1.6 KB | 69 lines |
- /* $Id: flashingLocation.java,v 1.2 1996/03/31 11:43:02 djun Exp djun $
-
- File: flashingLocation.java
-
- Extension of class Location - defines a location which flashes on
- the graphical image of the map.
-
- Author: Djun M. Kim
- Copyright (c) 1996 Djun M. Kim. All rights reserved.
-
- */
-
- import java.awt.*;
-
- public class flashingLocation extends Location implements Runnable {
-
- private boolean is_on = true;
- private int interval = 0;
- Thread runner;
-
- flashingLocation(Map parent, Location loc, int interval) {
- super(parent, loc.getBase());
- this.interval = interval;
- super.parent = parent;
- super.base = loc.getBase();
- super.region = loc.getRegion();
- super.name = loc.getName();
- super.url = loc.getURL();
- super.detail = loc.getDetailMap();
- super.entrances = loc.getEntrances();
- super.exits = loc.getExits();
- super.mapimg = loc.getMapimg();
- super.infotext = loc.getInfoText();
- super.keywords = loc.getKeywords();
- super.displayable = loc.isDisplayable();
- }
-
- public void start() {
- if (runner == null) {
- runner = new Thread(this);
- runner.start();
- }
- }
-
- public void stop() {
- if (runner != null) {
- runner.stop();
- runner = null;
- }
- }
-
- // flash the location at point loc in the hidden graphics
- public void run (){
- while (true) {
- try { Thread.currentThread().sleep(interval); }
- catch (InterruptedException e) { }
- is_on = false;
- try { Thread.currentThread().sleep(interval); }
- catch (InterruptedException e) { }
- is_on = true;
- }
- }
-
- // flash the location at point loc in the hidden graphics
- public boolean is_on(){
- return is_on;
- }
- }
-