OSDN Git Service

GUIのパネルボタンの配置を変更
[importpicture/importpicture.git] / importPicture / src / osm / jp / gpx / matchtime / gui / ParameterPanelImageFile.java
1 package osm.jp.gpx.matchtime.gui;
2
3 import java.awt.event.ActionEvent;
4 import java.awt.event.ActionListener;
5 import javax.swing.JButton;
6 import javax.swing.JFileChooser;
7
8 @SuppressWarnings("serial")
9 public class ParameterPanelImageFile extends ParameterPanel implements ActionListener {
10     JFileChooser fc;
11     JButton openButton;
12     ParameterPanelFolder paramDir;
13
14     @SuppressWarnings("OverridableMethodCallInConstructor")
15     public ParameterPanelImageFile(String label, String text, ParameterPanelFolder paramDir) {
16         super(label, text);
17
18         // "選択..."
19         openButton = new JButton(i18n.getString("button.select"));
20         
21         /*
22         openButton.addActionListener(this);
23         */
24         
25         this.add(openButton);
26         
27         //Create a file chooser
28         this.paramDir = paramDir;
29     }
30
31     @SuppressWarnings("override")
32     public void actionPerformed(ActionEvent e) {
33         /*
34         //Set up the file chooser.
35                 File sdir = new File(paramDir.getText());
36                 System.out.println(sdir.toPath());
37                 if (sdir.isDirectory()) {
38                 fc = new JFileChooser(sdir);
39                 }
40                 else {
41                 fc = new JFileChooser();
42                 }
43
44             //Add a custom file filter and disable the default
45             //(Accept All) file filter.
46         fc.addChoosableFileFilter(new ImageFilter());
47         fc.setAcceptAllFileFilterUsed(false);
48
49         //Add custom icons for file types.
50         fc.setFileView(new ImageFileView());
51
52         //Add the preview pane.
53         fc.setAccessory(new ImagePreview(fc));
54
55         //Show it.
56         int returnVal = fc.showDialog(ParameterPanelImageFile.this, "選択");
57
58         //Process the results.
59         if (returnVal == JFileChooser.APPROVE_OPTION) {
60             File file = fc.getSelectedFile();
61             this.argField.setText(file.getName());
62         }
63
64         //Reset the file chooser for the next time it's shown.
65         fc.setSelectedFile(null);
66         */
67     }
68 }