1 package osm.jp.gpx.matchtime.gui;
3 import java.awt.event.ActionEvent;
4 import java.awt.event.ActionListener;
7 import javax.swing.JButton;
8 import javax.swing.JFileChooser;
10 @SuppressWarnings("serial")
11 public class ParameterPanelGpx extends ParameterPanel implements ActionListener
16 @SuppressWarnings({"OverridableMethodCallInConstructor", "LeakingThisInConstructor"})
17 public ParameterPanelGpx(String label, String text) {
21 openButton = new JButton(
22 i18n.getString("button.select"),
23 AdjustTime.createImageIcon("images/Open16.gif")
25 openButton.addActionListener(this);
29 public void setEnable(boolean f) {
31 openButton.setEnabled(f);
35 public void actionPerformed(ActionEvent e) {
36 if (e.getSource() == openButton){
37 System.out.println("ParameterPanelGpx.actionPerformed(openButton)");
38 File sdir = new File(this.argField.getText());
40 this.fc = new JFileChooser(sdir);
43 this.fc = new JFileChooser();
45 this.fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
46 this.fc.addChoosableFileFilter(new GpxAndFolderFilter());
47 this.fc.setAcceptAllFileFilterUsed(false);
49 int returnVal = this.fc.showOpenDialog(ParameterPanelGpx.this);
51 if (returnVal == JFileChooser.APPROVE_OPTION) {
52 File file = this.fc.getSelectedFile();
53 this.argField.setText(file.getAbsolutePath());