source: src/main/java/onetomany/etc/Shape.java@ 256

Last change on this file since 256 was 253, checked in by Faria Nassiri Mofakham, 5 years ago

Commit #1 of:
+ negotiator.onetomany package refactored into onetomany package.
+ info created for all contained the packages.
+ current work defined under onetomany.bargainingchipsgame.
+ in this package, onetomany.bargainingchipsgame.players package includes packages for utility function, coordinator, negotiatior, and buyer and seller.
+ negotiator.onetomany package now contains nothing, can be deleted.
+ Interaction thread

File size: 1.3 KB
Line 
1/**
2 *
3 */
4
5// the idea of the last line, for g.fillPolygon(xValues, yValues, 31) "31 points'" could be useful
6
7package onetomany.etc;
8
9import java.awt.Color;
10import java.awt.Graphics;
11import java.awt.Point;
12
13//import javax.swing.*;
14//import java.awt.*;
15
16/**
17 * @author Faria Nassiri-Mofakham
18 *
19 */
20public abstract class Shape {
21
22 /**
23 *
24 */
25 protected Point location;
26 protected int dimension;
27 protected Color color;
28
29
30 public Color getColor() {
31 return color;
32 }
33
34 public void setColor(Color color) {
35 this.color = color;
36 }
37
38 public int getDimension() {
39 return dimension;
40 }
41
42 public void setDimensions(int dim) {
43 this.dimension = dim;
44 }
45
46 public Shape(Point loc, int dim, Color col)
47 {
48 setLocation(loc);
49 setDimensions(dim);
50 setColor(col);
51 }
52
53 public Point getLocation() {
54 return location;
55 }
56
57 public void setLocation(Point loc)
58 {
59 this.location = loc;
60 }
61
62 public void paint(Graphics g, Color c)
63 {
64 g.setColor(c);
65 draw(g);
66 }
67
68 public void draw(Graphics g)
69 {
70 int xLocation = this.getLocation().x;
71 int yLocation = this.getLocation().y;
72 int[] xValues = {xLocation, xLocation, xLocation+getDimension()};
73 int[] yValues = {yLocation, yLocation, yLocation+getDimension()};
74 g.fillPolygon(xValues, yValues, 31); //31 points
75 }
76}
Note: See TracBrowser for help on using the repository browser.