~ubuntu-branches/ubuntu/trusty/cdk/trusty-proposed

« back to all changes in this revision

Viewing changes to src/org/openscience/cdk/applications/jchempaint/StatusBar.java

  • Committer: Bazaar Package Importer
  • Author(s): Paul Cager
  • Date: 2008-04-09 21:17:53 UTC
  • Revision ID: james.westby@ubuntu.com-20080409211753-46lmjw5z8mx5pd8d
Tags: upstream-1.0.2
ImportĀ upstreamĀ versionĀ 1.0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  $RCSfile$
 
3
 *  $Author: egonw $
 
4
 *  $Date: 2007-01-04 18:26:00 +0100 (Thu, 04 Jan 2007) $
 
5
 *  $Revision: 7634 $
 
6
 *
 
7
 *  Copyright (C) 1997-2007  The JChemPaint project
 
8
 *
 
9
 *  Contact: jchempaint-devel@lists.sourceforge.net
 
10
 *
 
11
 *  This program is free software; you can redistribute it and/or
 
12
 *  modify it under the terms of the GNU Lesser General Public License
 
13
 *  as published by the Free Software Foundation; either version 2.1
 
14
 *  of the License, or (at your option) any later version.
 
15
 *  All we ask is that proper credit is given for our work, which includes
 
16
 *  - but is not limited to - adding the above copyright notice to the beginning
 
17
 *  of your source code files, and to any copyright notice that you may distribute
 
18
 *  with programs based on this work.
 
19
 *
 
20
 *  This program is distributed in the hope that it will be useful,
 
21
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
22
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
23
 *  GNU Lesser General Public License for more details.
 
24
 *
 
25
 *  You should have received a copy of the GNU Lesser General Public License
 
26
 *  along with this program; if not, write to the Free Software
 
27
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 
28
 */
 
29
package org.openscience.cdk.applications.jchempaint;
 
30
 
 
31
import java.awt.Dimension;
 
32
import java.awt.GridLayout;
 
33
 
 
34
import javax.swing.BorderFactory;
 
35
import javax.swing.JLabel;
 
36
import javax.swing.JPanel;
 
37
 
 
38
/**
 
39
 * JChemPaints status bar
 
40
 *
 
41
 * @cdk.module jchempaint
 
42
 * @author     steinbeck
 
43
 */
 
44
public class StatusBar extends JPanel
 
45
{
 
46
 
 
47
        private static final long serialVersionUID = 7075275608248231843L;
 
48
        JLabel[] status = new JLabel[3];
 
49
 
 
50
 
 
51
        /**
 
52
         *  Constructor for the StatusBar object
 
53
         */
 
54
        public StatusBar()
 
55
        {
 
56
                super();
 
57
 
 
58
                setLayout(new GridLayout(1, 3));
 
59
                setPreferredSize(new Dimension(660, 30));
 
60
                for (int i = 0; i <= 2; i++)
 
61
                {
 
62
                        status[i] = new JLabel();
 
63
                        status[i].setPreferredSize(new Dimension(220, 30));
 
64
                        status[i].setBorder(BorderFactory.createEtchedBorder());
 
65
                        status[i].setHorizontalAlignment(JLabel.CENTER);
 
66
                        add(status[i]);
 
67
                }
 
68
        }
 
69
 
 
70
 
 
71
        /**
 
72
         *  Sets the status attribute of the StatusBar object
 
73
         *
 
74
         *@param  label  The new status value
 
75
         *@param  text   The new status value
 
76
         */
 
77
        public void setStatus(int label, String text)
 
78
        {
 
79
                status[label - 1].setText(text);
 
80
        }
 
81
 
 
82
 
 
83
        /**
 
84
         *  Gets the status attribute of the StatusBar object
 
85
         *
 
86
         *@param  label  Description of the Parameter
 
87
         *@return        The status value
 
88
         */
 
89
        public String getStatus(int label)
 
90
        {
 
91
                return status[label - 1].getText();
 
92
        }
 
93
 
 
94
}
 
95