home *** CD-ROM | disk | FTP | other *** search
/ The Net: Ultimate Internet Guide / WWLCD1.ISO / pc / java / desvs7nu / src / jannetoolbartest.java < prev    next >
Encoding:
Java Source  |  1996-08-14  |  1.2 KB  |  46 lines

  1.  
  2. /** 
  3.  * Simple applet to test JanneToolbar class
  4.  */
  5. import java.awt.*;
  6. import java.awt.image.*;
  7. import java.applet.Applet;
  8.  
  9. public class JanneToolbarTest extends Applet {
  10.    
  11.    JanneToolbar toolbar;
  12.    
  13.    public void init() {
  14.       // test setting of background
  15.       setBackground(new Color(0xEED5B7));
  16.  
  17.       // get the images
  18.       Image constr = getImage(getDocumentBase(), "images/construction.gif");
  19.       Image newi = getImage(getDocumentBase(), "images/new.gif");
  20.       Image info = getImage(getDocumentBase(), "images/info.gif");
  21.       Image warning = getImage(getDocumentBase(), "images/warning.gif");
  22.       Image caution = getImage(getDocumentBase(), "images/caution.gif");
  23.  
  24.       // create toolbar panel
  25.       toolbar = new JanneToolbar(true, 4, true);
  26.       toolbar.addButton(constr, "constr");
  27.       toolbar.addButton(info, "info");
  28.       toolbar.addButton(newi, "new");
  29.       toolbar.addButton(warning, "warning");
  30.       toolbar.addButton(caution, "caution");
  31.       add(toolbar);
  32.    }
  33.  
  34.    /**
  35.     * Simple action to wite selected button to stdout
  36.     */
  37.    public boolean action(Event evt, Object arg) {
  38.       if (evt.target instanceof JanneButton) {
  39.      System.out.println("Button selected: " + (String)arg);
  40.       }
  41.       return true;
  42.    }
  43.    
  44. }
  45.  
  46.