-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStatusBar.java
More file actions
42 lines (32 loc) · 962 Bytes
/
StatusBar.java
File metadata and controls
42 lines (32 loc) · 962 Bytes
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 view;
import controller.ClickMode;
import javax.swing.*;
import java.awt.*;
/**
* Created by Hadi on 1/31/2015 9:40 PM.
*/
public class StatusBar extends JLabel {
public static final String STATUS = "Status. ";
public static final String MODE = "Click Mode: ";
public static final String POINT = "Map Point: ";
private ClickMode mCurrentMode = ClickMode.NONE;
private Point mCurrentPoint = new Point(0, 0);
public StatusBar() {
super("Status: ");
}
public void setMode(ClickMode mode) {
mCurrentMode = mode;
repaintBar();
}
public void setPoint(Point p) {
mCurrentPoint = p;
repaintBar();
}
public void repaintBar() {
setText(getText(mCurrentMode, mCurrentPoint));
repaint();
}
public static String getText(ClickMode m, Point p) {
return STATUS + MODE + m.toString() + ", " + POINT + "[" + p.x + ", " + p.y + "]";
}
}