-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDescribedPlace.java
More file actions
42 lines (29 loc) · 1.28 KB
/
DescribedPlace.java
File metadata and controls
42 lines (29 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package places;
import java.awt.Color;
import java.awt.Graphics;
public class DescribedPlace extends Place{
private String description;
/*-------------------------------------------------CONSTRUCTOR--------------------------------------------------------*/
public DescribedPlace(String name, Position position, Registry register, String description){
super(name, position, register);
this.description = description;
}
/*---------------------------------------------------METHODS----------------------------------------------------------*/
protected void paintPlaceInfo(Graphics g){
int newX = getSizeX() *3; // EXPERIMENT
int newY = getSizeY() *2;
System.out.println(getSizeX());
System.out.println(newX);
this.setBounds(getPositionX()-15,getPositionY()-25, newX , newY);
g.setColor(Color.WHITE);
g.fillRect(0, 0,getBounds().width-1, getBounds().height -1);
g.setColor(Color.BLACK);
g.drawString(getName(), 0, 0 + (getBounds().height - getSizeY()));
g.drawString(description, 0, 0 + (getBounds().height -1));
drawIfMarked(g);
}
@Override
public String toString() {
return "Described" +","+ getColor() +","+ getPosition().getX() +","+ getPosition().getY() +","+ getName() +","+ description;
}
}