001 package net.sourceforge.mp3dings.preferences;
002
003 /* Mp3dings - manage mp3 meta-information
004 * Copyright (C) 2003 Moritz Ringler
005 * $Id: SinglePanelModule.java,v 1.3 2006/09/25 17:34:42 ringler Exp $
006 *
007 * This program is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU General Public License
009 * as published by the Free Software Foundation; either version 2
010 * of the License, or (at your option) any later version.
011 *
012 * This program is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
015 * GNU General Public License for more details.
016 *
017 * You should have received a copy of the GNU General Public License
018 * along with this program; if not, write to the Free Software
019 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
020 */
021
022 import java.awt.BorderLayout;
023 import javax.swing.BorderFactory;
024 import javax.swing.JPanel;
025
026 /**
027 * A Preference Module, a container for a single PrefPanel.
028 * @author Moritz Ringler
029 * @version $Revision: 1.3 $ ($Date: 2006/09/25 17:34:42 $)
030 */
031 public class SinglePanelModule extends AbstractPrefModule{
032 JPanel child = new JPanel(new BorderLayout());
033
034 public SinglePanelModule(String name){
035 super(name);
036 setLayout(new BorderLayout());
037 add(getTitle(), BorderLayout.NORTH);
038 child.setBorder(BorderFactory.createMatteBorder(2,0,2,0,getBackground()));
039 child.setOpaque(true);
040 JPanel box = new JPanel(new BorderLayout());
041 box.setOpaque(false);
042 box.add(child, BorderLayout.NORTH);
043 add(box, BorderLayout.CENTER);
044 }
045
046 public void addPanel(PrefPanel panel){
047 myPanels.clear();
048 super.addPanel(panel);
049 child.removeAll();
050 child.add(panel, BorderLayout.NORTH);
051 }
052 }