1 | add(Box.createHorizontalStrut(5));↵ | | 1 | add(Box.createHorizontalStrut(5));↵
|
2 | add(filename);↵ | | 2 | add(filename);↵
|
3 | add(Box.createHorizontalStrut(5));↵ | | 3 | add(Box.createHorizontalStrut(5));↵
|
4 | filename.addActionListener(this);↵ | | 4 | filename.addActionListener(this);↵
|
5 | add(browse);↵ | | 5 | add(browse);↵
|
6 | browse.setActionCommand("browse");↵ | | 6 | browse.setActionCommand("browse");↵
|
7 | browse.addActionListener(this);↵ | | 7 | browse.addActionListener(this);↵
|
|
8 | }↵ | | 8 | }↵
|
|
9 | /**↵ | | 9 | /**↵
|
10 | * If the gui needs to enable/disable the FilePanel, call the method.↵ | | 10 | * If the gui needs to enable/disable the FilePanel, call the method.↵
|
11 | * ↵ | | 11 | * ↵
|
12 | * @param enable↵ | | 12 | * @param enable↵
|
13 | */↵ | | 13 | */↵
|
14 | public void enableFile(boolean enable) {↵ | | 14 | public void enableFile(boolean enable) {↵
|
15 | browse.setEnabled(enable);↵ | | 15 | browse.setEnabled(enable);↵
|
16 | filename.setEnabled(enable);↵ | | 16 | filename.setEnabled(enable);↵
|
17 | }↵ | | 17 | }↵
|
|
18 | /**↵ | | 18 | /**↵
|
19 | * Gets the filename attribute of the FilePanel object.↵ | | 19 | * Gets the filename attribute of the FilePanel object.↵
|
20 | * ↵ | | 20 | * ↵
|
21 | * @return the filename value↵ | | 21 | * @return the filename value↵
|
22 | */↵ | | 22 | */↵
|
23 | public String getFilename() {↵ | | 23 | public String getFilename() {↵
|
24 | return filename.getText();↵ | | 24 | return filename.getText();↵
|
25 | }↵ | | 25 | }↵
|
|
26 | /**↵ | | 26 | /**↵
|
27 | * Sets the filename attribute of the FilePanel object.↵ | | 27 | * Sets the filename attribute of the FilePanel object.↵
|
28 | * ↵ | | 28 | * ↵
|
29 | * @param f↵ | | 29 | * @param f↵
|
30 | * the new filename value↵ | | 30 | * the new filename value↵
|
31 | */↵ | | 31 | */↵
|
32 | public void setFilename(String f) {↵ | | 32 | public void setFilename(String f) {↵
|
33 | filename.setText(f);↵ | | 33 | filename.setText(f);↵
|
34 | }↵ | | 34 | }↵
|
|
35 | private void fireFileChanged() {↵ | | 35 | private void fireFileChanged() {↵
|
36 | Iterator iter = listeners.iterator();↵ | | 36 | Iterator iter = listeners.iterator();↵
|
37 | while (iter.hasNext()) {↵ | | 37 | while (iter.hasNext()) {↵
|
38 | ((ChangeListener) iter.next()).stateChanged(new ChangeEvent(this));↵ | | 38 | ((ChangeListener) iter.next()).stateChanged(new ChangeEvent(this));↵
|
39 | }↵ | | 39 | }↵
|
40 | | | 40 |
|