home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-01-24 | 1.0 KB | 50 lines |
- package COM.odi.demo.OSDraw;
-
- /**
- * <H3>Copyright (C) Object Design Inc. 1996, 1997</H3>
- */
-
- import COM.odi.*;
- import java.awt.Color;
-
- /*
- * Class OSColor is a persistence-capable class
- * OSColor cannot be a discrete instance in the database
- */
-
- public class OSColor {
-
- // Clone of Color class's RGB amounts
-
- private int redAmount; // Amount of red
- private int greenAmount; // Amount of green
- private int blueAmount; // Amount of blue
-
- // Constructor
-
- public OSColor(int redAmount, int greenAmount, int blueAmount) {
- this.redAmount = redAmount;
- this.greenAmount = greenAmount;
- this.blueAmount = blueAmount;
- }
-
- // Method to access private fields indirectly as a Color object
-
- public Color getColor() {
- return new Color(redAmount, greenAmount, blueAmount);
- }
-
- public void setColor(Color color) {
- redAmount = color.getRed();
- greenAmount = color.getGreen();
- blueAmount = color.getBlue();
- }
-
- // Default hashCode method
-
- public int hashCode() {
- return super.hashCode();
- }
- }
-
-