001 /* $Id: ListeningStatusBar.java 12 2007-07-27 09:48:53Z ringler $
002 * This class is part of the de.mospace.swing library.
003 * Copyright (C) 2005-2006 Moritz Ringler
004 *
005 * This program is free software; you can redistribute it and/or
006 * modify it under the terms of the GNU General Public License
007 * as published by the Free Software Foundation; either version 2
008 * of the License, or (at your option) any later version.
009 *
010 * This program is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
013 * GNU General Public License for more details.
014 *
015 * You should have received a copy of the GNU General Public License
016 * along with this program; if not, write to the Free Software
017 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
018 */
019 package de.mospace.swing;
020
021 import de.mospace.swing.event.MessageEvent;
022 import de.mospace.swing.event.MessageListener;
023
024 /**
025 * A status bar that gets the messages to display via MessageEvents.
026 * @see de.mospace.swing.event.MessageEvent
027 *
028 * @version $Revision: 12 $ ($Date: 2007-07-27 11:48:53 +0200 (Fr, 27 Jul 2007) $)
029 * @author Moritz Ringler
030 */
031 public class ListeningStatusBar extends StatusBar implements MessageListener {
032
033 /**
034 * Creates a new ListeningStatusBar object.
035 */
036 public ListeningStatusBar() {
037 super();
038 }
039
040 /**
041 * Creates a new ListeningStatusBar object.
042 *
043 * @param timeout DOCUMENT ME!
044 */
045 public ListeningStatusBar(int timeout) {
046 super(timeout);
047 }
048
049 public void messageSent(MessageEvent e) {
050 if(e.getTimeout() == MessageEvent.DEFAULT_TIMEOUT){
051 setStatus(e.getMessage());
052 } else {
053 setStatus(e.getMessage(), e.getTimeout());
054 }
055 }
056 }