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.1 KB
|
Line | |
---|
1 | package onetomany.etc;
|
---|
2 | import java.awt.Canvas;
|
---|
3 | import java.awt.Graphics;
|
---|
4 |
|
---|
5 |
|
---|
6 | /** Draws n circles, where n is the number of products in the portfolio.
|
---|
7 | * The circles are spaced apart by....
|
---|
8 | *
|
---|
9 | *
|
---|
10 | *
|
---|
11 | * @author Faria Nassiri-Mofakham
|
---|
12 | *
|
---|
13 | */
|
---|
14 | public class PortfolioDrawing extends Canvas
|
---|
15 | {
|
---|
16 |
|
---|
17 | private static final long serialVersionUID = 1L;
|
---|
18 | Portfolio p;
|
---|
19 |
|
---|
20 | public PortfolioDrawing(Portfolio p2)
|
---|
21 | {
|
---|
22 | p = p2;
|
---|
23 | }
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * Draws n circles, where n is the number of products in the portfolio.
|
---|
27 | * The circles are spaced apart by....
|
---|
28 | */
|
---|
29 | public void paint(Graphics g)
|
---|
30 | {
|
---|
31 | int z= p.size();
|
---|
32 | int r=30/z;
|
---|
33 | int yOffset=50;
|
---|
34 | int d=(g.getClipBounds().width-z*2*r)/(z+5);
|
---|
35 | int x = g.getClipBounds().x+ d; // it is now aligned, so the result seem be shown at the center!! but replace it with a mathematical formula which aligns it dynamically at the center
|
---|
36 |
|
---|
37 | for (Product product : p.getPortfolio())
|
---|
38 | {
|
---|
39 | g.setColor(product.getColor());
|
---|
40 | g.fillOval(x, g.getClipBounds().y+yOffset, 2*r, 2*r); // it also needs to became more dynamic
|
---|
41 | x += d;
|
---|
42 | }
|
---|
43 |
|
---|
44 | }
|
---|
45 | }
|
---|
46 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.