public class Chat
{
public String[] chatarray = {" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " " }; // 20
public int chatmax = 19;
public int chatpos = 0;
public Color[] chatcolor = new Color[20];
public void chat(Graphics g)
{
g.setColor(Color.cyan);
g.fillRect(180, 310, 310, 180);
g.setColor(Color.blue);
g.drawRect(180, 310, 310, 180);
g.drawString("Chat", 200, 330);
g.setColor(chatcolor[chatmax - (6 + chatpos)]);
g.drawString(chatarray[chatmax - (6 + chatpos)], 210, 350);
g.setColor(chatcolor[chatmax - (5 + chatpos)]);
g.drawString(chatarray[chatmax - (5 + chatpos)], 210, 370);
g.setColor(chatcolor[chatmax - (4 + chatpos)]);
g.drawString(chatarray[chatmax - (4 + chatpos)], 210, 390);
g.setColor(chatcolor[chatmax - (3 + chatpos)]);
g.drawString(chatarray[chatmax - (3 + chatpos)], 210, 410);
g.setColor(chatcolor[chatmax - (2 + chatpos)]);
g.drawString(chatarray[chatmax - (2 + chatpos)], 210, 430);
g.setColor(chatcolor[chatmax - (1 + chatpos)]);
g.drawString(chatarray[chatmax - (1 + chatpos)], 210, 450);
g.setColor(chatcolor[chatmax - (0 + chatpos)]);
g.drawString(chatarray[chatmax - (0 + chatpos)], 210, 470);
}
public void setchat(String m, Color c)
{
for(int i = 0; i < chatmax ; i++)
{
chatarray[i] = chatarray[i+1];
}
for(int i = 0; i < chatmax ; i++)
{
chatcolor[i] = chatcolor[i+1];
}
chatarray[chatmax] = m;
chatcolor[chatmax] = c;
}
}