View Javadoc

1   /*
2    * @(#)$Id: BrowseAction.java 689 2009-07-22 00:10:27Z bsigner $
3    *
4    * Author   : Ueli Kurmann, igesture@uelikurmann.ch
5    *                                   
6    *                                   
7    * Purpose  : 
8    *
9    * -----------------------------------------------------------------------
10   *
11   * Revision Information:
12   *
13   * Date       Who     Reason
14   *
15   * 23.03.2008 ukurmann  Initial Release
16   *
17   * -----------------------------------------------------------------------
18   *
19   * Copyright 1999-2009 ETH Zurich. All Rights Reserved.
20   *
21   * This software is the proprietary information of ETH Zurich.
22   * Use is subject to license terms.
23   * 
24   */
25  
26  
27  package org.ximtec.igesture.tool.view.databaseselector;
28  
29  import java.awt.event.ActionEvent;
30  
31  import javax.swing.AbstractAction;
32  import javax.swing.JFileChooser;
33  import javax.swing.JTextField;
34  
35  
36  public class BrowseAction extends AbstractAction {
37  
38     JTextField field;
39     
40     public BrowseAction(JTextField field) {
41        this.field = field;
42     }
43  
44  
45     @Override
46     public void actionPerformed(ActionEvent event) {
47        JFileChooser fc = new JFileChooser();
48        fc.showOpenDialog(null);
49        String name = fc.getSelectedFile().getAbsolutePath();
50        field.setText(name);
51     }
52  }