home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1999 April / DPPCPRO0499.ISO / April / Netobjs / Install.exe / data1.cab / Components / SiteMapper / button_panel.class (.txt) next >
Encoding:
Java Class File  |  1998-12-16  |  1.8 KB  |  55 lines

  1. import java.awt.BorderLayout;
  2. import java.awt.Button;
  3. import java.awt.Color;
  4. import java.awt.Component;
  5. import java.awt.Container;
  6. import java.awt.Event;
  7. import java.awt.FlowLayout;
  8. import java.awt.Panel;
  9.  
  10. public class button_panel extends Panel {
  11.    Sitemapper parent_applet;
  12.    int view;
  13.    static final int STRUCTURE_VIEW = 0;
  14.    static final int OUTLINE_VIEW = 1;
  15.    static final int SEARCH_VIEW = 2;
  16.  
  17.    public boolean action(Event evt, Object arg) {
  18.       if (arg.equals("Structure")) {
  19.          if (this.view != 0) {
  20.             this.parent_applet.remove_current_components(this.view);
  21.             this.parent_applet.add("South", this.parent_applet.user_level_panel);
  22.             this.parent_applet.display_view(this.view = 0);
  23.             return true;
  24.          }
  25.       } else if (arg.equals(" Outline ")) {
  26.          if (this.view != 1) {
  27.             this.parent_applet.remove_current_components(this.view);
  28.             this.parent_applet.add("South", this.parent_applet.user_level_panel);
  29.             this.parent_applet.display_view(this.view = 1);
  30.             return true;
  31.          }
  32.       } else if (arg.equals(" Search  ") && this.view != 2) {
  33.          this.parent_applet.remove_current_components(this.view);
  34.          this.parent_applet.remove(this.parent_applet.user_level_panel);
  35.          this.parent_applet.display_view(this.view = 2);
  36.          return true;
  37.       }
  38.  
  39.       return false;
  40.    }
  41.  
  42.    button_panel(Sitemapper parent_applet) {
  43.       this.parent_applet = parent_applet;
  44.       ((Component)this).setBackground(Color.lightGray);
  45.       ((Container)this).setLayout(new BorderLayout());
  46.       Panel p = new Panel();
  47.       ((Container)this).add("East", p);
  48.       ((Container)p).setLayout(new FlowLayout());
  49.       ((Container)p).add(new Button("Structure"));
  50.       ((Container)p).add(new Button(" Outline "));
  51.       ((Container)p).add(new Button(" Search  "));
  52.       this.view = 0;
  53.    }
  54. }
  55.