public class ChatDisplay
extends java.lang.Object
GUIMessage
.Modifier and Type | Field and Description |
---|---|
private static int |
MESSAGE_AGE
The amount of time before a message gets deleted (in milliseconds).
|
private static int |
MESSAGE_COUNT
The number of messages getting remembered.
|
private java.util.ArrayList<GUIMessage> |
messages |
Constructor and Description |
---|
ChatDisplay() |
Modifier and Type | Method and Description |
---|---|
void |
addMessage(GUIMessage message)
Adds a message to the list of messages that need to be displayed
on the GUI.
|
void |
display(java.awt.Graphics2D g,
ImageLibrary lib,
java.awt.Dimension size)
Displays the list of messages.
|
private GUIMessage |
getMessage(int index)
Gets the message at position 'index'.
|
private int |
getMessageCount()
Gets the amount of message that are currently being displayed
on this GUI.
|
boolean |
removeOldMessages()
Removes all the message that are older than MESSAGE_AGE.
|
private static final int MESSAGE_COUNT
private static final int MESSAGE_AGE
private final java.util.ArrayList<GUIMessage> messages
public void addMessage(GUIMessage message)
message
- The message to add.private GUIMessage getMessage(int index)
index
- The index of the message to return.private int getMessageCount()
public void display(java.awt.Graphics2D g, ImageLibrary lib, java.awt.Dimension size)
g
- The Graphics2D the messages should be displayed on.lib
- The imageLibrary to use.size
- The size of the space for displaying in.public boolean removeOldMessages()