home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / J A V A / Java Development Kit V1.2 / jdk12-win32(1).exe / data1.cab / demos / demo / jfc / SampleTree / SampleData.java < prev    next >
Encoding:
Java Source  |  1998-12-01  |  1.9 KB  |  91 lines

  1. /*
  2.  * @(#)SampleData.java    1.2 98/03/18
  3.  *
  4.  * Copyright 1997 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. import java.awt.Color;
  16. import java.awt.Font;
  17.  
  18. /**
  19.   * @version 1.2 03/18/98
  20.   * @author Scott Violet
  21.   */
  22.  
  23. public class SampleData extends Object
  24. {
  25.     /** Font used for drawing. */
  26.     protected Font          font;
  27.  
  28.     /** Color used for text. */
  29.     protected Color         color;
  30.  
  31.     /** Value to display. */
  32.     protected String        string;
  33.  
  34.  
  35.     /**
  36.       * Constructs a new instance of SampleData with the passed in
  37.       * arguments.
  38.       */
  39.     public SampleData(Font newFont, Color newColor, String newString) {
  40.     font = newFont;
  41.     color = newColor;
  42.     string = newString;
  43.     }
  44.  
  45.     /**
  46.       * Sets the font that is used to represent this object.
  47.       */
  48.     public void setFont(Font newFont) {
  49.     font = newFont;
  50.     }
  51.  
  52.     /**
  53.       * Returns the Font used to represent this object.
  54.       */
  55.     public Font getFont() {
  56.     return font;
  57.     }
  58.  
  59.     /**
  60.       * Sets the color used to draw the text.
  61.       */
  62.     public void setColor(Color newColor) {
  63.     color = newColor;
  64.     }
  65.  
  66.     /**
  67.       * Returns the color used to draw the text.
  68.       */
  69.     public Color getColor() {
  70.     return color;
  71.     }
  72.  
  73.     /**
  74.       * Sets the string to display for this object.
  75.       */
  76.     public void setString(String newString) {
  77.     string = newString;
  78.     }
  79.  
  80.     /**
  81.       * Returnes the string to display for this object.
  82.       */
  83.     public String string() {
  84.     return string;
  85.     }
  86.  
  87.     public String toString() {
  88.     return string;
  89.     }
  90. }
  91.