private
static
String
ChooseFolder(
)
{
JFileChooser
fc = new
JFileChooser
(
)
;
JList
list = new
JList
(
)
;
fc.setFileSelectionMode
(
JFileChooser
.DIRECTORIES_ONLY
)
;
if
(
JFileChooser
.APPROVE_OPTION
== fc.showOpenDialog
(
list)
)
{
File
file = fc.getSelectedFile
(
)
;
return
file.getPath
(
)
;
}
return
""
;
}
private
static
String
ChooseFile(
)
{
JFileChooser
fc = new
JFileChooser
(
)
;
JList
list = new
JList
(
)
;
fc.setFileSelectionMode
(
JFileChooser
.FILES_ONLY
)
;
if
(
JFileChooser
.APPROVE_OPTION
== fc.showOpenDialog
(
list)
)
{
File
file = fc.getSelectedFile
(
)
;
return
file.getPath
(
)
;
}
return
""
;
}