source: java-rpg-client/gamegui/Window.java@ f0f2ead

Last change on this file since f0f2ead was 55522be, checked in by dportnoy <dmp1488@…>, 17 years ago

[svn r8]

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