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