cassio
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
Felino
Valeu!!!
Para quem ainda tem dúvidas:
public static String localizarDiretorio(String mensagem) {
JFileChooser fcArquivo = new JFileChooser();
String sURL="";
if (sURL=="") {
fcArquivo.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
//fcArquivo.setAcceptAllFileFilterUsed(false);
//Parametro Mensagem
if (mensagem!="")
JOptionPane.showMessageDialog(TelaPrincipal.desktop,mensagem,"Atenção",JOptionPane.INFORMATION_MESSAGE);
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
}
catch (Exception e) {
e.printStackTrace();
}
SwingUtilities.updateComponentTreeUI(fcArquivo);
int res = fcArquivo.showOpenDialog(new JFrame());
if (res==JFileChooser.APPROVE_OPTION) {
sURL = ""+fcArquivo.getSelectedFile();
//System.out.println(sURL);
}
try {
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
}
catch (Exception e){
e.printStackTrace();
}
SwingUtilities.updateComponentTreeUI(fcArquivo);
}
return sURL;
}
Obrigado!