Line | |
---|
1 | package gamegui;
|
---|
2 |
|
---|
3 | import java.awt.*;
|
---|
4 | import java.awt.event.*;
|
---|
5 |
|
---|
6 | public class Member {
|
---|
7 | private String name;
|
---|
8 | private int x;
|
---|
9 | private int y;
|
---|
10 | private int width;
|
---|
11 | private int height;
|
---|
12 | private ScrollBar scrollbar;
|
---|
13 |
|
---|
14 | public Member(String newName, int newX, int newY, int newWidth, int newHeight) {
|
---|
15 | name = newName;
|
---|
16 | x = newX;
|
---|
17 | y = newY;
|
---|
18 | width = newWidth;
|
---|
19 | height = newHeight;
|
---|
20 | }
|
---|
21 |
|
---|
22 | public void draw(Graphics g) {
|
---|
23 |
|
---|
24 | }
|
---|
25 |
|
---|
26 | public boolean handleEvent(MouseEvent e) {
|
---|
27 | return false;
|
---|
28 | }
|
---|
29 |
|
---|
30 | public boolean isClicked(int xCoord, int yCoord) {
|
---|
31 | return x <= xCoord && xCoord <= x+width && y <= yCoord && yCoord <= y+height;
|
---|
32 | }
|
---|
33 |
|
---|
34 | public void clear() {
|
---|
35 |
|
---|
36 | }
|
---|
37 |
|
---|
38 | public String getName() {
|
---|
39 | return name;
|
---|
40 | }
|
---|
41 |
|
---|
42 | public int getX() {
|
---|
43 | return x;
|
---|
44 | }
|
---|
45 |
|
---|
46 | public int getY() {
|
---|
47 | return y;
|
---|
48 | }
|
---|
49 |
|
---|
50 | public int getWidth() {
|
---|
51 | return width;
|
---|
52 | }
|
---|
53 |
|
---|
54 | public int getHeight() {
|
---|
55 | return height;
|
---|
56 | }
|
---|
57 |
|
---|
58 | public ScrollBar getScrollBar() {
|
---|
59 | return scrollbar;
|
---|
60 | }
|
---|
61 |
|
---|
62 | public void addScrollBar(ScrollBar newBar) {
|
---|
63 | newBar.offset(x, y);
|
---|
64 | scrollbar = newBar;
|
---|
65 | }
|
---|
66 |
|
---|
67 | protected void offset(int xOffset, int yOffset) {
|
---|
68 | x += xOffset;
|
---|
69 | y += yOffset;
|
---|
70 |
|
---|
71 | if(scrollbar != null)
|
---|
72 | scrollbar.offset(xOffset, yOffset);
|
---|
73 | }
|
---|
74 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.