01: /**********************************************************************************
02:
03: Feedzeo!
04: A free and open source RSS/Atom/RDF feed aggregator
05:
06: Copyright (C) 2005-2006 Anand Rao (anandrao@users.sourceforge.net)
07:
08: This library is free software; you can redistribute it and/or
09: modify it under the terms of the GNU Lesser General Public
10: License as published by the Free Software Foundation; either
11: version 2.1 of the License, or (at your option) any later version.
12:
13: This library is distributed in the hope that it will be useful,
14: but WITHOUT ANY WARRANTY; without even the implied warranty of
15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16: Lesser General Public License for more details.
17:
18: You should have received a copy of the GNU Lesser General Public
19: License along with this library; if not, write to the Free Software
20: Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21:
22: ************************************************************************************/package util;
23:
24: import java.util.*;
25: import java.awt.*;
26: import javax.swing.*;
27:
28: /**
29: *
30: * @author Anand Rao
31: */
32: public class WinUtil {
33:
34: private static JDialog dlg = null;
35: private static JLabel msgLbl = null;
36: private static boolean initialized = false;
37:
38: /** Creates a new instance of WinUtil */
39: public WinUtil() {
40: }
41:
42: private static void createMsgDlg() {
43: dlg = new JDialog(new Frame(), false); //non-modal dlg
44: msgLbl = new JLabel("");
45:
46: dlg.getContentPane().add(msgLbl);
47: dlg.setUndecorated(true);
48: }
49:
50: public static void showOneLineWinMsg(String msg) {
51: if (!initialized) {
52: createMsgDlg();
53: initialized = true;
54: }
55: msgLbl.setText(" " + msg);
56: dlg.setSize(200, 50);
57: dlg.setLocation(200, 200);
58: dlg.setVisible(true);
59: }
60:
61: public static void hideOneLineWinMsg() {
62: msgLbl.setText("");
63: dlg.setVisible(false);
64: }
65:
66: /*
67: public static void main(String[] args) {
68: WinUtil.showOneLineWinMsg("Hello world");
69: int i=0;
70: while (i < 100000000) i++;
71: WinUtil.hideOneLineWinMsg();
72: System.exit(0);
73: }
74: */
75:
76: }
|