KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jac > aspects > gui > swing > FilePathEditor


1 /*
2   Copyright (C) 2004 Laurent Martelli <laurent@aopsys.com>
3   
4   This program is free software; you can redistribute it and/or modify
5   it under the terms of the GNU Lesser General Public License as
6   published by the Free Software Foundation; either version 2 of the
7   License, or (at your option) any later version.
8
9   This program is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12   GNU Lesser General Public License for more details.
13
14   You should have received a copy of the GNU Lesser General Public License
15   along with this program; if not, write to the Free Software
16   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */

17
18 package org.objectweb.jac.aspects.gui.swing;
19
20 import java.awt.Dimension JavaDoc;
21 import java.awt.event.ActionEvent JavaDoc;
22 import java.awt.event.ActionListener JavaDoc;
23 import java.io.File JavaDoc;
24 import javax.swing.JButton JavaDoc;
25 import javax.swing.JFileChooser JavaDoc;
26 import org.objectweb.jac.aspects.gui.FieldEditor;
27 import org.objectweb.jac.aspects.gui.ResourceManager;
28 import org.objectweb.jac.core.rtti.FieldItem;
29
30 /**
31  * This is a special value editor that allows the user to nicely edit
32  * a file path.
33  */

34 public class FilePathEditor extends AbstractFileEditor
35     implements FieldEditor, ActionListener JavaDoc
36 {
37    /**
38     * Constructs a new File editor.
39     */

40     public FilePathEditor(Object JavaDoc substance, FieldItem field) {
41         super(substance,field);
42     }
43
44     public Object JavaDoc getValue() {
45         return textField.getText();
46     }
47
48     public void setValue(Object JavaDoc value) {
49         super.setValue(value);
50         if (value==null)
51             textField.setText("");
52         else
53             textField.setText((String JavaDoc)value);
54     }
55 }
56
Popular Tags