Main Page   Packages   Class Hierarchy   Compound List   File List   Compound Members  

PreferencesPanel.java

00001 /*
00002  *  Copyright 2006-2007 Columbia University.
00003  *
00004  *  This file is part of MEAPsoft.
00005  *
00006  *  MEAPsoft is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License version 2 as
00008  *  published by the Free Software Foundation.
00009  *
00010  *  MEAPsoft is distributed in the hope that it will be useful, but
00011  *  WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  *  General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with MEAPsoft; if not, write to the Free Software
00017  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
00018  *  02110-1301 USA
00019  *
00020  *  See the file "COPYING" for the text of the license.
00021  */
00022 
00023 package com.meapsoft.gui;
00024 
00025 import java.awt.*;
00026 import java.awt.event.*;
00027 import java.io.*;
00028 import java.util.*;
00029 import javax.swing.*; 
00030 import javax.swing.border.*; 
00031 
00032 import com.meapsoft.*;
00033 
00034 public class PreferencesPanel extends MEAPsoftGUIPanel
00035 {
00036         //prefs/about
00037         JTextField dataBaseNameField;
00038     JTextField audioPlayerField;
00039         JCheckBox saveFilesPrefBox;
00040 
00044     public PreferencesPanel(MEAPsoftGUI msg)
00045         {
00046         super(msg);
00047         BuildPrefsAboutGUI();
00048 
00049         title = "Preferences";
00050         helpURL += "#" + title;
00051     }
00052 
00053         private void BuildPrefsAboutGUI()
00054     {
00055                 Color c = new Color((int)(Math.random() * 127 + 127),
00056                                         (int)(Math.random() * 127 + 127),
00057                                         (int)(Math.random() * 127 + 127));
00058         color = c;
00059         
00060                 setBackground(c);
00061                 BoxLayout prefsAboutBL = new BoxLayout(this, BoxLayout.Y_AXIS);
00062                 setLayout(prefsAboutBL);
00063 
00064                 add(helpButton);
00065                 
00066                 JPanel prefsPanel = new JPanel();
00067                 prefsPanel.setLayout(new BoxLayout(prefsPanel, BoxLayout.Y_AXIS));
00068                 prefsPanel.setBackground(c);
00069                 TitledBorder title = BorderFactory.createTitledBorder(
00070                         BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), 
00071                         "Preferences");
00072                 title.setTitleJustification(TitledBorder.CENTER);
00073                 prefsPanel.setBorder(title);
00074 
00075                 JPanel panel = new JPanel();
00076                 panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
00077         panel.setBackground(c);
00078 
00079         JPanel dBNPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
00080                 dBNPanel.setBackground(c);
00081                 
00082                 JLabel dataBaseNameLabel = new JLabel("file i/o base name: ");
00083                 dataBaseNameLabel.setToolTipText("Name used to construct filenames for " 
00084                                          + "intermediate processing steps.");
00085                 dBNPanel.add(dataBaseNameLabel);
00086                 dataBaseNameField = new JTextField("mann");
00087                 dataBaseNameField.setColumns(10);
00088                 dataBaseNameField.addActionListener(this);
00089                 dataBaseNameField.setActionCommand("dataBaseName");
00090                 dBNPanel.add(dataBaseNameField);
00091                 JButton dataBaseNameUpdateButton = new JButton("update");
00092                 dataBaseNameUpdateButton.setBackground(c);
00093                 dataBaseNameUpdateButton.addActionListener(this);
00094                 dataBaseNameUpdateButton.setActionCommand("dataBaseName");
00095                 dBNPanel.add(dataBaseNameUpdateButton);
00096         dBNPanel.setAlignmentX(Component.RIGHT_ALIGNMENT);
00097                 panel.add(dBNPanel);
00098                 
00099         JPanel aPPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
00100         //aPPanel.setLayout(new BoxLayout(aPPanel, BoxLayout.X_AXIS));
00101         aPPanel.setBackground(c);
00102                 
00103                 JLabel audioPlayerLabel = new JLabel("audio player: ");
00104                 aPPanel.add(audioPlayerLabel);
00105         if(audioPlayerName != null)
00106             audioPlayerField = new JTextField(audioPlayerName);
00107         else
00108             audioPlayerField = new JTextField("select audio player");
00109                 audioPlayerField.setColumns(10);
00110                 audioPlayerField.addActionListener(this);
00111         audioPlayerField.setActionCommand("selectAudioPlayer");
00112                 aPPanel.add(audioPlayerField);
00113                 JButton audioPlayerBrowseButton = new JButton("browse");
00114                 audioPlayerBrowseButton.setBackground(c);
00115                 audioPlayerBrowseButton.addActionListener(this);
00116         audioPlayerBrowseButton.setActionCommand("browseAudioPlayer");
00117         dataBaseNameUpdateButton.setPreferredSize(
00118             audioPlayerBrowseButton.getPreferredSize());
00119                 aPPanel.add(audioPlayerBrowseButton);           
00120         aPPanel.setAlignmentX(Component.RIGHT_ALIGNMENT);
00121         panel.add(aPPanel);
00122                 prefsPanel.add(panel);
00123 
00124         panel = new JPanel();
00125         panel.setBackground(c);
00126         saveFilesPrefBox = new JCheckBox("save .seg .edl .feat files");
00127                 saveFilesPrefBox.setBackground(c);
00128                 saveFilesPrefBox.setSelected(true);
00129                 panel.add(saveFilesPrefBox);
00130         prefsPanel.add(panel);
00131         prefsPanel.setAlignmentX(Component.CENTER_ALIGNMENT);
00132 
00133                 add(prefsPanel);
00134 
00135                 JPanel aboutPanel = new JPanel();
00136                 aboutPanel.setBackground(c);
00137                 TitledBorder title2 = BorderFactory.createTitledBorder(
00138                         BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), 
00139                         "About MEAPsoft");
00140                 title2.setTitleJustification(TitledBorder.CENTER);
00141                 aboutPanel.setBorder(title2);
00142                 
00143                 JTextArea aboutTextArea = new JTextArea();
00144                 aboutTextArea.setBackground(c);
00145                 
00146                 String aboutText = 
00147             "MEAPsoft was created by the participants in the " + 
00148             "Music Engineering Art Project at Columbia University.\n" +
00149             "\n" +
00150             "For more information, please see:\n" +
00151             "http://labrosa.ee.columbia.edu/meapsoft\n" +
00152             "\n" +
00153             "Sponsored by:\n" + 
00154             "The Academic Quality Fund\n" + 
00155             "LabROSA: http://labrosa.ee.columbia.edu \n" +
00156             "The Computer Music Center: http://music.columbia.edu/cmc \n" +
00157             "\n" +
00158             "Development by:\n" +
00159             "Ron Weiss, Douglas Repetto, Mike Mandel, Dan Ellis, Victor Adan, Jeff Snyder\n" +
00160             "\n" +
00161             "Additional contributions by:\n" +
00162             "John Arroyo, Johanna Devaney, Dan Iglesia, Graham Poliner\n\n" +
00163             "MEAPsoft version " + MEAPUtil.version;
00164 
00165                 aboutTextArea.setText(aboutText);
00166         aboutTextArea.setEditable(false);
00167         aboutTextArea.setColumns(50);
00168                 aboutTextArea.setLineWrap(true);
00169                 aboutTextArea.setWrapStyleWord(true);
00170         aboutPanel.add(aboutTextArea);
00171                 
00172                 add(aboutPanel);
00173         }
00174 
00175         public void actionPerformed(ActionEvent arg0)
00176         {
00177                 String command = arg0.getActionCommand();
00178 
00179                 if (command.equals("dataBaseName"))
00180                 {
00181             dataBaseName = dataBaseNameField.getText();
00182             UpdateFileNames();
00183             meapsoftGUI.UpdateInfoTexts();
00184                 }
00185                 else if (command.equals("selectAudioPlayer"))
00186         {
00187             audioPlayerName = audioPlayerField.getText();
00188         }
00189                 else if (command.equals("browseAudioPlayer"))
00190         {
00191             String names[] = 
00192                 GUIUtils.FileSelector(GUIUtils.OPEN, meapsoftGUI.dataDirectory, meapsoftGUI.jframe);
00193             
00194                         
00195                         if(names[0] != null)
00196             {            
00197                 audioPlayerName = names[0];
00198                 audioPlayerField.setText(audioPlayerName);
00199             }
00200         }
00201     }
00202 
00203     public int run()
00204     {
00205         return 0;
00206     }
00207 }

Generated on Tue Feb 6 19:02:27 2007 for MEAPsoft by doxygen1.2.18