001/* ======================================================================== 002 * JCommon : a free general purpose class library for the Java(tm) platform 003 * ======================================================================== 004 * 005 * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors. 006 * 007 * Project Info: http://www.jfree.org/jcommon/index.html 008 * 009 * This library is free software; you can redistribute it and/or modify it 010 * under the terms of the GNU Lesser General Public License as published by 011 * the Free Software Foundation; either version 2.1 of the License, or 012 * (at your option) any later version. 013 * 014 * This library is distributed in the hope that it will be useful, but 015 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 016 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 017 * License for more details. 018 * 019 * You should have received a copy of the GNU Lesser General Public 020 * License along with this library; if not, write to the Free Software 021 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 022 * USA. 023 * 024 * [Java is a trademark or registered trademark of Sun Microsystems, Inc. 025 * in the United States and other countries.] 026 * 027 * -------------------- 028 * L1R1ButtonPanel.java 029 * -------------------- 030 * (C) Copyright 2000-2004, by Object Refinery Limited. 031 * 032 * Original Author: David Gilbert (for Object Refinery Limited); 033 * Contributor(s): -; 034 * 035 * $Id: L1R1ButtonPanel.java,v 1.4 2007/11/02 17:50:36 taqua Exp $ 036 * 037 * Changes (from 26-Oct-2001) 038 * -------------------------- 039 * 26-Oct-2001 : Changed package to com.jrefinery.ui.* (DG); 040 * 26-Jun-2002 : Removed unnecessary import (DG); 041 * 14-Oct-2002 : Fixed errors reported by Checkstyle (DG); 042 * 043 */ 044 045package org.jfree.ui; 046 047import java.awt.BorderLayout; 048import javax.swing.JButton; 049import javax.swing.JPanel; 050 051/** 052 * A 'ready-made' panel that has one button on the left and another button on the right - a layout 053 * manager takes care of resizing. 054 * 055 * @author David Gilbert 056 */ 057public class L1R1ButtonPanel extends JPanel { 058 059 /** The button on the left. */ 060 private JButton left; 061 062 /** The button on the right. */ 063 private JButton right; 064 065 /** 066 * Standard constructor - creates a two-button panel with the specified labels. 067 * 068 * @param leftLabel the label for the left button. 069 * @param rightLabel the label for the right button. 070 */ 071 public L1R1ButtonPanel(final String leftLabel, final String rightLabel) { 072 073 setLayout(new BorderLayout()); 074 this.left = new JButton(leftLabel); 075 this.right = new JButton(rightLabel); 076 add(this.left, BorderLayout.WEST); 077 add(this.right, BorderLayout.EAST); 078 079 } 080 081 /** 082 * Returns a reference to button 1, allowing the caller to set labels, action-listeners etc. 083 * 084 * @return the button. 085 */ 086 public JButton getLeftButton() { 087 return this.left; 088 } 089 090 /** 091 * Returns a reference to button 2, allowing the caller to set labels, action-listeners etc. 092 * 093 * @return the button. 094 */ 095 public JButton getRightButton() { 096 return this.right; 097 } 098 099}