formatter
Class Message

java.lang.Object
  extended by formatter.Message
All Implemented Interfaces:
Event

public class Message
extends java.lang.Object
implements Event

Messages are logical combinations of a sender, time stamp, and text with font. They are the small strings of text that you send back and forth in IMs.


Constructor Summary
Message(java.lang.String sender, Timestamp time, java.lang.String message, boolean auto)
          Creates a new Message. Assumes black-on-white text.
Message(java.lang.String sender, Timestamp time, java.lang.String message, java.awt.Color color, java.awt.Font font, boolean auto)
          Creates a new Message.
 
Method Summary
 void append(java.lang.String msg)
          Appends the text of the String to the end of this Message
 void append(java.lang.String msg, java.lang.String f, java.awt.Color c)
          Appends the text of the String to the end of this Message
 void append(java.lang.String msg, java.lang.String f, java.awt.Color c, int s, boolean b, boolean i)
          Appends the text of the String to the end of this Message
 void appendNewline()
          Puts a simple newline at the end of the current message.
 java.awt.Color getColor()
          Gets the font Color of the message.
 java.awt.Font getFont()
          Gets the font face of the message.
 java.lang.String getMessage()
          Gets the text of the message sent.
 java.lang.String getSender()
          Gets the screenname of the sender of this message.
 Timestamp getTimestamp()
          Gets the Time this message was sent.
 boolean isAutoGenerated()
          Returns true when the Message is auto-generated and false when it is not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Message

public Message(java.lang.String sender,
               Timestamp time,
               java.lang.String message,
               boolean auto)
Creates a new Message. Assumes black-on-white text.

Parameters:
sender - Screen name of the sender.
time - The time the message was sent.
message - The text of the message.
auto - Whether this is an auto-generated message or not.

Message

public Message(java.lang.String sender,
               Timestamp time,
               java.lang.String message,
               java.awt.Color color,
               java.awt.Font font,
               boolean auto)
Creates a new Message.

Parameters:
sender - Screen name of the sender.
time - The time the message was sent.
message - The text of the message.
color - The color of the text of the message.
font - The font the message should be in.
auto - Whether this is an auto-generated message or not.
Method Detail

getSender

public java.lang.String getSender()
Gets the screenname of the sender of this message.

Returns:
The screenname of the sender.

getMessage

public java.lang.String getMessage()
Gets the text of the message sent. This method ignores any formatting information stored with the string.

Returns:
The text of the message, without any formatting information.

getColor

public java.awt.Color getColor()
Gets the font Color of the message.

Returns:
The font color of the message.

getFont

public java.awt.Font getFont()
Gets the font face of the message.

Returns:
The font face.

getTimestamp

public Timestamp getTimestamp()
Gets the Time this message was sent.

Specified by:
getTimestamp in interface Event
Returns:
The time the message was sent.

isAutoGenerated

public boolean isAutoGenerated()
Returns true when the Message is auto-generated and false when it is not.

Returns:
Whether this is an auto-generated message or not.

append

public void append(java.lang.String msg)
Appends the text of the String to the end of this Message

Parameters:
msg - The text to append to the end of this Message.

append

public void append(java.lang.String msg,
                   java.lang.String f,
                   java.awt.Color c)
Appends the text of the String to the end of this Message

Parameters:
msg - The text to append to the end of this Message.
f - The font name of this part of the message.
c - The color of this part of the message.

append

public void append(java.lang.String msg,
                   java.lang.String f,
                   java.awt.Color c,
                   int s,
                   boolean b,
                   boolean i)
Appends the text of the String to the end of this Message

Parameters:
msg - The text to append to the end of this Message.
f - The font name of this part of the message.
c - The color of this part of the message.
s - The size of the font in pts.
b - true if the appended part of the message is bold, false otherwise.
i - true if the appended part of the message is italicized, false otherwise.

appendNewline

public void appendNewline()
Puts a simple newline at the end of the current message.