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

Last change on this file since 220 was 219, checked in by Faria Nassiri Mofakham, 6 years ago

'Line' problem (and in GUI) fixed. (There also have been several updates in other files before this commit!!)

File size: 929 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; // 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
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 }
38}
Note: See TracBrowser for help on using the repository browser.