KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > excalibur > instrument > client > StatusBar


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14  * implied.
15  *
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */

19
20 package org.apache.excalibur.instrument.client;
21
22 import java.awt.BorderLayout JavaDoc;
23
24 import javax.swing.JLabel JavaDoc;
25 import javax.swing.JPanel JavaDoc;
26
27 /**
28  * This class defines the status bar at the bottom of the main frame.
29  * It is used to display information to the user.
30  *
31  * @author <a HREF="mailto:dev@avalon.apache.org">Avalon Development Team</a>
32  * @version CVS $Revision: 1.4 $ $Date: 2004/02/28 11:47:23 $
33  * @since 4.1
34  */

35 class StatusBar extends JPanel JavaDoc
36 {
37     private JLabel JavaDoc m_statusLabel;
38     
39     /*---------------------------------------------------------------
40      * Constructors
41      *-------------------------------------------------------------*/

42     StatusBar()
43     {
44         setLayout( new BorderLayout JavaDoc() );
45         m_statusLabel = new JLabel JavaDoc( " " );
46         add( m_statusLabel, BorderLayout.CENTER );
47     }
48     
49     /*---------------------------------------------------------------
50      * Methods
51      *-------------------------------------------------------------*/

52     void setStatusMessage( String JavaDoc message )
53     {
54         // If the message is of 0 length, then the status bar will collapse.
55
if ( ( message == null ) || ( message.length() < 1 ) )
56         {
57             message = " ";
58         }
59         
60         if ( !message.equals( m_statusLabel.getText() ) )
61         {
62             m_statusLabel.setText( message );
63             m_statusLabel.invalidate();
64             validate();
65         }
66     }
67 }
68
Popular Tags