我想使用下面的代码打开pdf文件,但方法是getHostServices();即使我有正确的进口,也找不到。
import javafx.application.HostServices;
ClinicFiles clinicFiles = (ClinicFiles) listViewClinic.getSelectionModel().getSelectedItem();
HostServices hostServices = getHostServices();
hostServices.showDocument(clinicFiles.getAbsolutePath());
答案 0 :(得分:1)
您的课程可能不会从import javafx.application.Application;
import javafx.application.HostServices;
public class App extends Application {
public void method(String[] args) {
ClinicFiles clinicFiles = (ClinicFiles) listViewClinic.getSelectionModel().getSelectedItem();
HostServices hostServices = getHostServices();
hostServices.showDocument(clinicFiles.getAbsolutePath());
}
}
例如:
$0