Logo
Distributed Genetic Programming Framework
print print

File org.dgpf.gui.components.DirChooserPanel.java

Here you can find all the information about the file org.dgpf.gui.components.DirChooserPanel.java. You may explore it here or download it onto your local disk.
/*
 * Copyright (c) 2006 Mirko Dietrich
 * 
 * E-Mail           : mirkodietrich@hrz.uni-kassel.de
 * Creation Date    : Sep 2, 2006 4:34:15 PM
 * Original Filename: org.dgpf.gui.components.DirChooserPanel.java
 * Version          : 1.0
 * Last modification: Sep 2, 2006
 * Last modified by : Mirko Dietrich
 * 
 * License          : GNU LESSER GENERAL PUBLIC LICENSE
 *                    Version 2.1, February 1999
 *                    You should have received a copy of this license along
 *                    with this library; if not, write to the Free Software
 *                    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *                    MA 02111-1307, USA or download the license under
 *                    http://www.gnu.org/copyleft/lesser.html.
 *                    
 * Warranty         : This software is provided "as is" without any
 *                    warranty; without even the implied warranty of
 *                    merchantability or fitness for a particular purpose.
 *                    See the Gnu Lesser General Public License for more
 *                    details.
 */


package org.dgpf.gui.components;

import java.awt.event.ActionEvent;
import java.io.File;

import javax.swing.JFileChooser;

/**
 * Used to select a directory.
 * 
 * @author Mirko Dietrich.
 */

public class DirChooserPanel extends FileChooserPanel
  {

  /**
   * serialVersionUID.
   */

  private static final long serialVersionUID = 7617872015954741469L;

  /**
   * Default constructor.
   * 
   * @param p_caption
   *          The caption of the panel.
   * @param p_file
   *          The file.
   * @param p_fcCaption
   *          The file chooser caption.
   * @param p_fcFileFilter
   *          The file filter caption in the file chooser.
   * @param p_fcFileExtension
   *          The file extension for the file chooser.
   * @param p_fcFileName
   *          The file chooser file name.
   * @param p_fcButtonCaption
   *          The file chooser button caption.
   */

  public DirChooserPanel(String p_caption, String p_file,
      String p_fcCaption, String p_fcFileFilter, String p_fcFileExtension,
      String p_fcFileName, String p_fcButtonCaption)
    {
    super(p_caption, p_file, p_fcCaption, p_fcFileFilter,
        p_fcFileExtension, p_fcFileName, p_fcButtonCaption);
    }

  /**
   * Reacts on button clicks.
   * 
   * @param p_e
   *          Action event.
   */

  @Override
  public void actionPerformed(ActionEvent p_e)
    {
    String cmd = p_e.getActionCommand();
    if(cmd.equals("browse"))
      {
      callFileChooser();
      }
    }

  /**
   * This method calls the file chooser, for selecting a path and the file.
   */

  private void callFileChooser()
    {
    FileChooser l_fileChooser = new FileChooser();
    l_fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    File l_file = l_fileChooser.getFile(this.m_fileChooserCaption,
        new DGPFFileFilter(this.m_fileChooserFileFilter,
            this.m_fileChooserFileExtension), this.m_fileChooserFileName,
        this.m_fileChooserButtonCaption);
    if(null != l_file)
      {
      this.m_panelFile = l_file.toString();
      }
    this.m_pathField.setText(this.m_panelFile);
    }

  }

File Information:

file name:DirChooserPanel.java
package:org.dgpf.gui.components
qualified name:org.dgpf.gui.components.DirChooserPanel.java
file type:Java Source File
download location:download http://dgpf.sourceforge.net/source/org/dgpf/gui/components/DirChooserPanel.java
size:3.157 KB (3233 B)
uploaded: 2015-07-22 04:10:58 GMT+0000
last update: 2006-09-24 23:47:04 GMT+0000
last access: 2017-11-23 05:20:43 GMT+0000

statistics online since 2006-01-02.   RSS Feed
Contact us by sending an email to tweise@gmx.de to receive further information, to report errors, or to join our project.
All content on this site (http://dgpf.sourceforge.net/) is LGPL-licensed.
http://dgpf.sourceforge.net/scripts/source/source.php last modified at 2015-07-22 04:10:53 GMT+0000 served at 2017-11-23 05:20:43 GMT+0000.
Valid CSS Valid XHTML 1.1
Valid RSS SourceForge.net Logo