home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1997 October / PCO1097.ISO / FilesBBS / FREI / FSCROLL.EXE / SRC / FunScrollAbout.java < prev    next >
Encoding:
Java Source  |  1997-08-06  |  1.6 KB  |  81 lines

  1. /*
  2.  * Copyright (c) 1995 by Jan Andersson, Torpa Konsult AB.
  3.  *
  4.  * Permission to use, copy, and distribute this software for
  5.  * NON-COMMERCIAL purposes and without fee is hereby granted
  6.  * provided that this copyright notice appears in all copies.
  7.  */
  8. import java.awt.*;
  9. import java.applet.Applet;
  10.  
  11. /**
  12.  * FunScroll "about" popup.
  13.  *
  14.  * @version 1.1 97/08/06
  15.  * @author  Jan Andersson (janne@torpa.se)
  16.  */
  17. public class FunScrollAbout extends Frame
  18. {
  19.    
  20.    static final int rows = 27;
  21.    static final int cols = 70;
  22.     
  23.    TextArea info;
  24.    Button close;
  25.  
  26.    /**
  27.     * Create About popup frame
  28.     */
  29.    FunScrollAbout(String label) {
  30.       super(label);
  31.  
  32.       add("Center", info = new TextArea(rows, cols));
  33.       info.setEditable(false);
  34.       //info.setBackground(Color.white);
  35.  
  36.       Panel buttons = new Panel();
  37.       add("South", buttons);
  38.       buttons.add(close = new Button("Close"));
  39.       
  40.       pack();
  41.    }
  42.  
  43.    /**
  44.     * Show frame
  45.     */
  46.    public void show() {
  47.       info.select(0,0);
  48.       super.show();
  49.    }
  50.  
  51.    /**
  52.     * Append text
  53.     */
  54.    void appendText(String s) {
  55.       info.appendText(s);
  56.    }
  57.    
  58.    /**
  59.     * Handle window destroy event
  60.     */
  61.    public boolean handleEvent(Event e) {
  62.       if (e.id == Event.WINDOW_DESTROY) {
  63.      dispose();
  64.      return true;
  65.       }
  66.       return super.handleEvent(e);
  67.    }
  68.  
  69.    /**
  70.     * Handle "close" button action
  71.     */
  72.    public boolean action(Event e, Object arg) {
  73.       if (e.target == close) {
  74.      //hide();
  75.      dispose();
  76.      return true;
  77.       }
  78.       return false;
  79.    }
  80. }
  81.