Last change
on this file since 224 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:
732 bytes
|
Line | |
---|
1 | package negotiator.onetomany;
|
---|
2 |
|
---|
3 | import java.awt.Color;
|
---|
4 |
|
---|
5 | /**
|
---|
6 | * A product, such as Paracetamol, or a Red Dot
|
---|
7 | */
|
---|
8 | public class Product
|
---|
9 | {
|
---|
10 |
|
---|
11 | String id;
|
---|
12 |
|
---|
13 | public Product(String id)
|
---|
14 | {
|
---|
15 | this.id = id;
|
---|
16 | }
|
---|
17 |
|
---|
18 | @Override
|
---|
19 | public String toString()
|
---|
20 | {
|
---|
21 | return id;
|
---|
22 | }
|
---|
23 |
|
---|
24 | public Color getColor() //anyway, gives the result in RGB ! :)
|
---|
25 |
|
---|
26 | {
|
---|
27 | switch(id.toLowerCase())
|
---|
28 | {
|
---|
29 | case "red":
|
---|
30 | return Color.RED;
|
---|
31 | case "blue":
|
---|
32 | return Color.BLUE;
|
---|
33 | case "pink":
|
---|
34 | return Color.PINK;
|
---|
35 | default:
|
---|
36 | System.out.println("Undefined color!");
|
---|
37 | return null;
|
---|
38 | }
|
---|
39 | }
|
---|
40 |
|
---|
41 | public Color getRGBColor(String s) // to be able to pass colors in RGB hex strings
|
---|
42 | {
|
---|
43 | return Color.decode(s);
|
---|
44 | }
|
---|
45 |
|
---|
46 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.