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 / OSOval.java < prev    next >
Encoding:
Java Source  |  1997-01-24  |  1.8 KB  |  101 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.*;
  9.  
  10. /*
  11.  * Class OSOval is a persistence-capable class
  12.  * BitMapObject subclass
  13.  * Capable of being a discrete instance in the database
  14.  */
  15.  
  16. public class OSOval extends BitMapObject {
  17.  
  18.   // Database fields
  19.  
  20.   private int x;
  21.   private int y;        // Point (x,y) is at the top left
  22.  
  23.   private int widthaxis;
  24.   private int heightaxis;
  25.  
  26.   private OSColor color;    // Persistence-capable Color class
  27.  
  28.   private boolean fill;
  29.  
  30.   public OSOval(int x, int y, int widthaxis, int heightaxis) {
  31.     this.x = x;
  32.     this.y = y;
  33.     this.widthaxis = widthaxis;
  34.     this.heightaxis = heightaxis;
  35.     color = new OSColor(0, 0, 0);
  36.     fill = false;
  37.   }
  38.  
  39.   // Method to draw the figure
  40.  
  41.   public void drawFigure(Graphics g) {
  42.     g.setColor(color.getColor());
  43.     if (fill) {
  44.       g.fillOval(x, y, widthaxis, heightaxis);
  45.     }
  46.     else {
  47.       g.drawOval(x, y, widthaxis, heightaxis);
  48.     }
  49.   }
  50.  
  51.   // Methods to access private fields
  52.  
  53.   public Point getPoint() {
  54.     return new Point(x, y);
  55.   }
  56.  
  57.   public void setPoint(Point point) {
  58.     this.x = x;
  59.     this.y = y;
  60.   }
  61.  
  62.   public int getWidth() {
  63.     return widthaxis;
  64.   }
  65.  
  66.   public void setWidth(int widthaxis) {
  67.     this.widthaxis = widthaxis;
  68.   }
  69.  
  70.   public int getHeight() {
  71.     return heightaxis;
  72.   }
  73.  
  74.   public void setHeight(int heightaxis) {
  75.     this.heightaxis = heightaxis;
  76.   }
  77.  
  78.   public Color getColor() {
  79.     return color.getColor();
  80.   }
  81.  
  82.   public void setColor(Color color) {
  83.     this.color.setColor(color);
  84.   }
  85.  
  86.   public boolean getFillStatus() {
  87.     return fill;
  88.   }
  89.  
  90.   public void setFillStatus(boolean fill) {
  91.     this.fill = fill;
  92.   }
  93.  
  94.   // Default hashCode method
  95.  
  96.   public int hashCode() {
  97.     return super.hashCode();
  98.   }
  99. }
  100.  
  101.