01: /*
02: ** $Id: StatusBar.java,v 1.3 2000/10/26 08:34:15 mrw Exp $
03: **
04: ** Mike Wilson, July 2000, mrw@whisperingwind.co.uk
05: **
06: ** (C) Copyright 2000, Mike Wilson, Reading, Berkshire, UK
07: **
08: ** This program is free software; you can redistribute it and/or modify
09: ** it under the terms of the GNU General Public License as published by
10: ** the Free Software Foundation; either version 2 of the License, or
11: ** (at your option) any later version.
12: **
13: ** This program 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
16: ** GNU General Public License for more details.
17: **
18: ** You should have received a copy of the GNU Library General
19: ** Public License along with this library; if not, write to the
20: ** Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21: ** Boston, MA 02111-1307 USA.
22: */
23:
24: package uk.co.whisperingwind.framework;
25:
26: import java.awt.GridBagConstraints;
27: import java.awt.GridBagLayout;
28: import javax.swing.JPanel;
29: import javax.swing.JTextField;
30:
31: /**
32: ** Simple status bar widget. Typically placed at the bottom of a frame
33: ** or dialog.
34: */
35:
36: public class StatusBar extends JPanel {
37: private JTextField statusText = new JTextField();
38:
39: public StatusBar() {
40: setLayout(new GridBagLayout());
41:
42: GridBagConstraints constraints = new GridBagConstraints();
43:
44: constraints.fill = GridBagConstraints.HORIZONTAL;
45: constraints.anchor = GridBagConstraints.CENTER;
46: constraints.weightx = 1.0;
47:
48: add(statusText, constraints);
49: statusText.setEditable(false);
50: }
51:
52: /**
53: ** Set the status bar text.
54: **
55: ** @param text the text to display in the status bar.
56: */
57:
58: public void setText(String text) {
59: statusText.setText(text);
60: }
61:
62: /**
63: ** Clear the status bar.
64: */
65:
66: public void clear() {
67: setText("");
68: }
69: }
|