[7d9c033] | 1 | package gamegui;
|
---|
| 2 |
|
---|
| 3 | import java.awt.Color;
|
---|
| 4 | import java.awt.Graphics;
|
---|
| 5 | import java.util.ArrayList;
|
---|
| 6 |
|
---|
| 7 | public class Window extends Member {
|
---|
| 8 | ArrayList members;
|
---|
| 9 | boolean fullscreen;
|
---|
| 10 |
|
---|
| 11 | public Window(final String newName, final int newX, final int newY, final int newWidth, final int newHeight) {
|
---|
| 12 | super(newName, newX, newY, newWidth, newHeight);
|
---|
| 13 | this.members = new ArrayList();
|
---|
| 14 | }
|
---|
| 15 |
|
---|
| 16 | public Window(final String newName, final int newX, final int newY, final int newWidth, final int newHeight, final boolean full) {
|
---|
| 17 | super(newName, newX, newY, newWidth, newHeight);
|
---|
| 18 | this.members = new ArrayList();
|
---|
| 19 | this.fullscreen = full;
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | public void draw(final Graphics g) {
|
---|
| 23 | g.setColor(Color.black);
|
---|
| 24 | g.fillRect(this.getX(), this.getY(), this.getWidth(), this.getHeight());
|
---|
| 25 | if (!this.fullscreen) {
|
---|
| 26 | g.setColor(Color.red);
|
---|
| 27 | g.drawRect(this.getX(), this.getY(), this.getWidth(), this.getHeight());
|
---|
| 28 | }
|
---|
| 29 | for (int x = 0; x < this.members.size(); ++x) {
|
---|
| 30 | ((Member)this.members.get(x)).draw(g);
|
---|
| 31 | }
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | public void clear() {
|
---|
| 35 | for (int x = 0; x < this.members.size(); ++x) {
|
---|
| 36 | ((Member)this.members.get(x)).clear();
|
---|
| 37 | }
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | public void add(final Member aMember) {
|
---|
| 41 | this.members.add(aMember);
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | public Member getMember(final String aName) {
|
---|
| 45 | for (int x = 0; x < this.members.size(); ++x) {
|
---|
| 46 | if (((Member)this.members.get(x)).getName().equals(aName)) {
|
---|
| 47 | return (Member)this.members.get(x);
|
---|
| 48 | }
|
---|
| 49 | }
|
---|
| 50 | return null;
|
---|
| 51 | }
|
---|
| 52 | }
|
---|