1
/* ========================================================================
2
* JCommon : a free general purpose class library for the Java(tm) platform
3
* ========================================================================
5
* (C) Copyright 2000-2005, by Object Refinery Limited and Contributors.
7
* Project Info: http://www.jfree.org/jcommon/index.html
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.
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.
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,
24
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
25
* in the United States and other countries.]
27
* --------------------
28
* L1R3ButtonPanel.java
29
* --------------------
30
* (C) Copyright 2000-2004, by Object Refinery Limited.
32
* Original Author: David Gilbert (for Object Refinery Limited);
35
* $Id: L1R3ButtonPanel.java,v 1.3 2005/10/18 13:18:34 mungady Exp $
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);
47
import java.awt.BorderLayout;
49
import javax.swing.JButton;
50
import javax.swing.JPanel;
53
* A 'ready-made' panel that has one button on the left and three buttons on the right - nested
54
* panels and layout managers take care of resizing.
56
* @author David Gilbert
58
public class L1R3ButtonPanel extends JPanel {
60
/** The left button. */
63
/** The first button on the right of the panel. */
64
private JButton right1;
66
/** The second button on the right of the panel. */
67
private JButton right2;
69
/** The third button on the right of the panel. */
70
private JButton right3;
73
* Standard constructor - creates panel with the specified button labels.
75
* @param label1 the label for button 1.
76
* @param label2 the label for button 2.
77
* @param label3 the label for button 3.
78
* @param label4 the label for button 4.
80
public L1R3ButtonPanel(final String label1, final String label2, final String label3, final String label4) {
82
setLayout(new BorderLayout());
84
// create the pieces...
85
final JPanel panel = new JPanel(new BorderLayout());
86
final JPanel panel2 = new JPanel(new BorderLayout());
87
this.left = new JButton(label1);
88
this.right1 = new JButton(label2);
89
this.right2 = new JButton(label3);
90
this.right3 = new JButton(label4);
92
// ...and put them together
93
panel.add(this.left, BorderLayout.WEST);
94
panel2.add(this.right1, BorderLayout.EAST);
95
panel.add(panel2, BorderLayout.CENTER);
96
panel.add(this.right2, BorderLayout.EAST);
97
add(panel, BorderLayout.CENTER);
98
add(this.right3, BorderLayout.EAST);
103
* Returns a reference to button 1, allowing the caller to set labels, action-listeners etc.
105
* @return the left button.
107
public JButton getLeftButton() {
112
* Returns a reference to button 2, allowing the caller to set labels, action-listeners etc.
114
* @return the right button 1.
116
public JButton getRightButton1() {
121
* Returns a reference to button 3, allowing the caller to set labels, action-listeners etc.
123
* @return the right button 2.
125
public JButton getRightButton2() {
130
* Returns a reference to button 4, allowing the caller to set labels, action-listeners etc.
132
* @return the right button 3.
134
public JButton getRightButton3() {