source: lost-perception/gamegui/Member.java@ 0b84f13

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

Initial commit. This codebase for the Lost Perception game was created by decompiling code from a jar file.

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