Mercurial > hg > ristipolku
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/game/IDMWindow.java Thu Mar 16 12:22:30 2017 +0200 @@ -0,0 +1,34 @@ +/* + * Ristipolku IDM window + * (C) Copyright 2011 Matti 'ccr' Hämäläinen <ccr@tnsp.org> + */ +package game; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; + + + +public class IDMWindow extends IDMContainer +{ + private ArrayList<String> messages; + + public IDMWindow() + { + messages = new ArrayList<String>(); + } + + public void sendMessage(String msg) + { + messages.add(0, msg); + } + + public String getMessage() + { + if (messages.size() > 0) + return messages.remove(0); + else + return null; + } +}