home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-01-24 | 1.8 KB | 101 lines |
- package COM.odi.demo.OSDraw;
-
- /**
- * <H3>Copyright (C) Object Design Inc. 1996, 1997</H3>
- */
-
- import COM.odi.*;
- import java.awt.*;
-
- /*
- * Class OSOval is a persistence-capable class
- * BitMapObject subclass
- * Capable of being a discrete instance in the database
- */
-
- public class OSOval extends BitMapObject {
-
- // Database fields
-
- private int x;
- private int y; // Point (x,y) is at the top left
-
- private int widthaxis;
- private int heightaxis;
-
- private OSColor color; // Persistence-capable Color class
-
- private boolean fill;
-
- public OSOval(int x, int y, int widthaxis, int heightaxis) {
- this.x = x;
- this.y = y;
- this.widthaxis = widthaxis;
- this.heightaxis = heightaxis;
- color = new OSColor(0, 0, 0);
- fill = false;
- }
-
- // Method to draw the figure
-
- public void drawFigure(Graphics g) {
- g.setColor(color.getColor());
- if (fill) {
- g.fillOval(x, y, widthaxis, heightaxis);
- }
- else {
- g.drawOval(x, y, widthaxis, heightaxis);
- }
- }
-
- // Methods to access private fields
-
- public Point getPoint() {
- return new Point(x, y);
- }
-
- public void setPoint(Point point) {
- this.x = x;
- this.y = y;
- }
-
- public int getWidth() {
- return widthaxis;
- }
-
- public void setWidth(int widthaxis) {
- this.widthaxis = widthaxis;
- }
-
- public int getHeight() {
- return heightaxis;
- }
-
- public void setHeight(int heightaxis) {
- this.heightaxis = heightaxis;
- }
-
- public Color getColor() {
- return color.getColor();
- }
-
- public void setColor(Color color) {
- this.color.setColor(color);
- }
-
- public boolean getFillStatus() {
- return fill;
- }
-
- public void setFillStatus(boolean fill) {
- this.fill = fill;
- }
-
- // Default hashCode method
-
- public int hashCode() {
- return super.hashCode();
- }
- }
-
-