1 18 19 package org.objectweb.jac.aspects.gui.swing; 20 21 import org.objectweb.jac.core.rtti.FieldItem; 22 import java.awt.event.ActionEvent ; 23 import javax.swing.JFileChooser ; 24 25 28 29 public class DirectoryURLEditor extends URLEditor { 30 31 public DirectoryURLEditor(Object substance, FieldItem field) { 32 super(substance,field); 33 } 34 35 public void actionPerformed(ActionEvent evt) { 36 if (evt.getActionCommand().equals("choose")) { 37 JFileChooser chooser = new JFileChooser (); 38 chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); 39 int returnVal = chooser.showOpenDialog( this ); 40 if ( returnVal == JFileChooser.APPROVE_OPTION ) { 41 textField.setText( "file:" + chooser.getSelectedFile().toString() ); 42 } 43 } 44 } 45 } 46 | Popular Tags |