source: lost-haven/gamegui/Window.java

Last change on this file was 8edd04e, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 4 years ago

Make the decompiled game code compile successfully

  • Property mode set to 100644
File size: 1.8 KB
Line 
1package gamegui;
2
3import java.awt.*;
4import java.awt.event.MouseEvent;
5import java.util.ArrayList;
6
7public class Window extends Member {
8
9 ArrayList<Member> members;
10 boolean fullscreen;
11
12 public Window(String newName, int newX, int newY, int newWidth, int newHeight) {
13 super(newName, newX, newY, newWidth, newHeight);
14 this.members = new ArrayList<Member>();
15 }
16
17 public Window(String newName, int newX, int newY, int newWidth, int newHeight, boolean full) {
18 super(newName, newX, newY, newWidth, newHeight);
19 this.members = new ArrayList<Member>();
20 this.fullscreen = full;
21 }
22
23 public void draw(Graphics g) {
24 g.setColor(Color.black);
25 g.fillRect(getX(), getY(), getWidth(), getHeight());
26 if (!this.fullscreen) {
27 g.setColor(Color.red);
28 g.drawRect(getX(), getY(), getWidth(), getHeight());
29 }
30 for (int x = 0; x < this.members.size(); x++) {
31 ((Member)this.members.get(x)).draw(g);
32 }
33 }
34
35 public boolean handleEvent(MouseEvent e) {
36 boolean val = false;
37 for (int x = 0; x < this.members.size(); x++) {
38 val = !(!val && !((Member)this.members.get(x)).handleEvent(e));
39 }
40 return val;
41 }
42
43 public void clear() {
44 for (int x = 0; x < this.members.size(); x++) {
45 ((Member)this.members.get(x)).clear();
46 }
47 }
48
49 public void add(Member aMember) {
50 aMember.offset(getX(), getY());
51 this.members.add(aMember);
52 }
53
54 public void offset(int xOffset, int yOffset) {
55 super.offset(xOffset, yOffset);
56 for (int x = 0; x < this.members.size(); x++) {
57 ((Member)this.members.get(x)).offset(xOffset, yOffset);
58 }
59 }
60
61 public Member getMember(String aName) {
62 for (int x = 0; x < this.members.size(); x++) {
63 if (((Member)this.members.get(x)).getName().equals(aName)) {
64 return this.members.get(x);
65 }
66 }
67 return null;
68 }
69}
Note: See TracBrowser for help on using the repository browser.