home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / JAVA_ALL / IDE / SUBARTIC / SUB_ARCT / LIB / BACKDROP.JAV < prev    next >
Encoding:
Text File  |  1996-10-04  |  2.8 KB  |  97 lines

  1. package sub_arctic.lib;
  2.  
  3. import sub_arctic.output.drawable;
  4. import sub_arctic.output.loaded_image;
  5.  
  6. import java.awt.Graphics;
  7.  
  8. /**
  9.  * Interactor which makes a row with a given background.
  10.  *
  11.  * @author Scott Hudson
  12.  */
  13. public class backdrop_row extends row {
  14.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  15.  
  16.   /** Background pattern */
  17.   protected loaded_image _pattern = null;
  18.  
  19.   /** 
  20.    * Get the background pattern.
  21.    * @return loaded_image the pattern on this background.
  22.    */
  23.   public loaded_image pattern() {return _pattern;}
  24.  
  25.   /** 
  26.    * Set the Background pattern. 
  27.    * @param loaded_image pat the new pattern for this background.
  28.    */
  29.   public void set_pattern(loaded_image pat) 
  30.     {
  31.       /* set pattern and cause redraw */
  32.       if (_pattern != pat)
  33.     {
  34.           _pattern = pat;
  35.       damage_self();
  36.     }
  37.     }
  38.  
  39.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  40.  
  41.   /** 
  42.    * Full constructor.  We assume you will set the size and position
  43.    * with constraints or directly set the values.
  44.    *
  45.    * @param int          brd   number of pixels of border.
  46.    * @param int          ic    the interchild spacing (in pixels).
  47.    * @param boolean      boxed true if you want a box around this object.
  48.    * @param boolean      sbc   size by children (should the size of the object 
  49.    *                           be determined by its children).
  50.    * @param byte         lt    the layout type (defined in row).
  51.    * @param loaded_image pat   the background pattern to use.
  52.    */
  53.   public backdrop_row(
  54.     int brd, int ic, 
  55.     boolean boxed, boolean sbc, byte lt,
  56.     loaded_image pat)
  57.     {
  58.       super(0,0,10,10,brd,ic,boxed,false,sbc,lt,null);
  59.       set_pattern(pat);
  60.     }
  61.  
  62.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  63.  
  64.   /**
  65.    * Draw the object. 
  66.    * @param drawable d the surface to draw on.
  67.    */ 
  68.   protected void draw_self_local(drawable d) 
  69.     {
  70.       /* draw the backdrop then let the super class do the rest */
  71.       if (pattern() != null)
  72.         d.tileImage(pattern(), 0,0, w()-1, h()-1);
  73.  
  74.       super.draw_self_local(d);
  75.     }
  76.  
  77.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  78.  
  79. }
  80.  
  81. /*=========================== COPYRIGHT NOTICE ===========================
  82.  
  83. This file is part of the subArctic user interface toolkit.
  84.  
  85. Copyright (c) 1996 Scott Hudson and Ian Smith
  86. All rights reserved.
  87.  
  88. The subArctic system is freely available for most uses under the terms
  89. and conditions described in 
  90.   http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html 
  91. and appearing in full in the lib/interactor.java source file.
  92.  
  93. The current release and additional information about this software can be 
  94. found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
  95.  
  96. ========================================================================*/
  97.