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

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

Fonts work at GUI JLabels!

File size: 1.5 KB
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 void paint(Graphics g)
21 {
22 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
23 for (Product product : p.getPortfolio())
24 {
25 g.setColor(product.getColor());
26 g.fillOval(x, 100, 20, 20); // it also need to became dynamic
27 x += 50;
28 }
29 //simpleFill(g, p);
30 //ComplexFill(g);
31 }
32
33
34 // public Drawing(DemandPlan p2)
35 // {
36 // p = p2.get;
37 // }
38
39
40
41 // private void simpleFill(Graphics g, Portfolio port)
42 // {
43 // for (Product product : port.getPortfolio())
44 // {
45 // g.setColor(product.getColor());
46 // 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
47 // g.fillOval(x, 100, 20, 20); // it also need to became dynamic
48 // x += 50;
49 // }
50 // }
51 //
52 // private void ComplexFill(Graphics g) {
53 // // TODO Auto-generated method stub
54 //
55 // }
56}
Note: See TracBrowser for help on using the repository browser.