source: src/main/java/negotiator/onetomany/etc/Drawing.java@ 215

Last change on this file since 215 was 215, checked in by Faria Nassiri Mofakham, 6 years ago
File size: 856 bytes
Line 
1package negotiator.onetomany.etc;
2import java.awt.Canvas;
3import java.awt.Color;
4import java.awt.Graphics;
5import javax.swing.JFrame;
6
7import negotiator.onetomany.DemandPlan;
8import negotiator.onetomany.Portfolio;
9import negotiator.onetomany.Product;
10
11public class Drawing extends Canvas
12{
13 Portfolio p;
14
15 public Drawing(Portfolio p2)
16 {
17 p = p2;
18 }
19
20// public Drawing(DemandPlan p2)
21// {
22// p = p2.get;
23// }
24
25 public void paint(Graphics g)
26 {
27 //int x = 100;
28 int x = g.getClipBounds().x+ g.getClipBounds().width/3; // replace with a mathematical formula which aligns it dynamically at the center
29 for (Product product : p.getPortfolio())
30 {
31 g.setColor(product.getColor());
32 g.fillOval(x, 100, 20, 20); // it also need to became dynamic
33 x += 50;
34 }
35
36 }
37}
Note: See TracBrowser for help on using the repository browser.