source: last-defense/gamegui/Member.java@ ca2a854

Last change on this file since ca2a854 was fb4fc67, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 6 years ago

Initial commit, code decompiled from a jar

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