KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfree > ui > L1R1ButtonPanel


1 /* ========================================================================
2  * JCommon : a free general purpose class library for the Java(tm) platform
3  * ========================================================================
4  *
5  * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors.
6  *
7  * Project Info: http://www.jfree.org/jcommon/index.html
8  *
9  * This library is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU Lesser General Public License as published by
11  * the Free Software Foundation; either version 2.1 of the License, or
12  * (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17  * License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22  * USA.
23  *
24  * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
25  * in the United States and other countries.]
26  *
27  * --------------------
28  * L1R1ButtonPanel.java
29  * --------------------
30  * (C) Copyright 2000-2004, by Object Refinery Limited.
31  *
32  * Original Author: David Gilbert (for Object Refinery Limited);
33  * Contributor(s): -;
34  *
35  * $Id: L1R1ButtonPanel.java,v 1.3 2005/10/18 13:18:34 mungady Exp $
36  *
37  * Changes (from 26-Oct-2001)
38  * --------------------------
39  * 26-Oct-2001 : Changed package to com.jrefinery.ui.* (DG);
40  * 26-Jun-2002 : Removed unnecessary import (DG);
41  * 14-Oct-2002 : Fixed errors reported by Checkstyle (DG);
42  *
43  */

44
45 package org.jfree.ui;
46
47 import java.awt.BorderLayout JavaDoc;
48
49 import javax.swing.JButton JavaDoc;
50 import javax.swing.JPanel JavaDoc;
51
52 /**
53  * A 'ready-made' panel that has one button on the left and another button on the right - a layout
54  * manager takes care of resizing.
55  *
56  * @author David Gilbert
57  */

58 public class L1R1ButtonPanel extends JPanel JavaDoc {
59
60     /** The button on the left. */
61     private JButton JavaDoc left;
62
63     /** The button on the right. */
64     private JButton JavaDoc right;
65
66     /**
67      * Standard constructor - creates a two-button panel with the specified labels.
68      *
69      * @param leftLabel the label for the left button.
70      * @param rightLabel the label for the right button.
71      */

72     public L1R1ButtonPanel(final String JavaDoc leftLabel, final String JavaDoc rightLabel) {
73
74         setLayout(new BorderLayout JavaDoc());
75         this.left = new JButton JavaDoc(leftLabel);
76         this.right = new JButton JavaDoc(rightLabel);
77         add(this.left, BorderLayout.WEST);
78         add(this.right, BorderLayout.EAST);
79
80     }
81
82     /**
83      * Returns a reference to button 1, allowing the caller to set labels, action-listeners etc.
84      *
85      * @return the button.
86      */

87     public JButton JavaDoc getLeftButton() {
88         return this.left;
89     }
90
91     /**
92      * Returns a reference to button 2, allowing the caller to set labels, action-listeners etc.
93      *
94      * @return the button.
95      */

96     public JButton JavaDoc getRightButton() {
97         return this.right;
98     }
99
100 }
101
Popular Tags