Mercurial > hg > ristipolku
comparison game/IDMWindow.java @ 180:fa9f29387cff
Implement a very simplistic message queue system.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 16 Mar 2017 12:22:30 +0200 |
parents | |
children | 996d332d87d1 |
comparison
equal
deleted
inserted
replaced
179:ac5cf78a1cd2 | 180:fa9f29387cff |
---|---|
1 /* | |
2 * Ristipolku IDM window | |
3 * (C) Copyright 2011 Matti 'ccr' Hämäläinen <ccr@tnsp.org> | |
4 */ | |
5 package game; | |
6 | |
7 import java.awt.*; | |
8 import java.awt.event.*; | |
9 import java.util.*; | |
10 | |
11 | |
12 | |
13 public class IDMWindow extends IDMContainer | |
14 { | |
15 private ArrayList<String> messages; | |
16 | |
17 public IDMWindow() | |
18 { | |
19 messages = new ArrayList<String>(); | |
20 } | |
21 | |
22 public void sendMessage(String msg) | |
23 { | |
24 messages.add(0, msg); | |
25 } | |
26 | |
27 public String getMessage() | |
28 { | |
29 if (messages.size() > 0) | |
30 return messages.remove(0); | |
31 else | |
32 return null; | |
33 } | |
34 } |