JFileChooser
에서 파일을 선택하는 프로그램을 작성하고 있습니다. 내가 파일 형식을 얻을 수있는 방법
나는 다음과 같은 코드가 (예를 들어, 해당 파일은 "가 .txt "또는 등등, " .DAT"의 ".html 중에서"입니다). 여분의 라인을 추가해야하는 것은 무엇입니까?JFileChooser로 선택한 파일의 형식을 가져옵니다.
JFileChooser choice = new JFileChooser();
int option = choice.showOpenDialog(this);
if (option == JFileChooser.APPROVE_OPTION)
{
String path=choice.getSelectedFile().getAbsolutePath();
String filename=choice.getSelectedFile().getName();
System.out.println(path);
listModel.addElement(path);
System.out.println(filename);
}
확장자 : 파일 이름을 가지고 있기 때문에 단순히 모든 c 파일 이름 문자열의 마지막 점을 포함하여 haracters. – RaptorDotCpp