home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Extras / ODesign / SetupPSE.exe / data.z / OSColor.java < prev    next >
Encoding:
Java Source  |  1997-01-24  |  1.0 KB  |  50 lines

  1. package COM.odi.demo.OSDraw;
  2.  
  3. /**
  4.  *      <H3>Copyright (C) Object Design Inc. 1996, 1997</H3>
  5.  */
  6.  
  7. import COM.odi.*;
  8. import java.awt.Color;
  9.  
  10. /*
  11.  * Class OSColor is a persistence-capable class
  12.  * OSColor cannot be a discrete instance in the database
  13.  */
  14.  
  15. public class OSColor {
  16.  
  17.   // Clone of Color class's RGB amounts
  18.  
  19.   private int redAmount;    // Amount of red
  20.   private int greenAmount;    // Amount of green
  21.   private int blueAmount;    // Amount of blue
  22.  
  23.   // Constructor
  24.  
  25.   public OSColor(int redAmount, int greenAmount, int blueAmount) {
  26.     this.redAmount = redAmount;
  27.     this.greenAmount = greenAmount;
  28.     this.blueAmount = blueAmount;
  29.   }
  30.  
  31.   // Method to access private fields indirectly as a Color object
  32.  
  33.   public Color getColor() {
  34.     return new Color(redAmount, greenAmount, blueAmount);
  35.   }
  36.  
  37.   public void setColor(Color color) {
  38.     redAmount = color.getRed();
  39.     greenAmount = color.getGreen();
  40.     blueAmount = color.getBlue();
  41.   }
  42.  
  43.   // Default hashCode method
  44.  
  45.   public int hashCode() {
  46.     return super.hashCode();
  47.   }
  48. }
  49.  
  50.