Java 将映像复制到localhost/images
我在使用javafx的桌面应用程序中工作。 这是我的密码。当用户单击按钮Java 将映像复制到localhost/images,java,javafx,Java,Javafx,我在使用javafx的桌面应用程序中工作。 这是我的密码。当用户单击按钮uploadimage以选择图像,然后我想将其保存在localhost/images中时,将调用方法telechargerImage()。 请原谅我的英语 private Image imagelog; @FXML private ImageView image; @FXML private JFXButton uploadimage; private FileChooser fileChooser = new FileC
uploadimage
以选择图像,然后我想将其保存在localhost/images中时,将调用方法telechargerImage()
。
请原谅我的英语
private Image imagelog;
@FXML
private ImageView image;
@FXML
private JFXButton uploadimage;
private FileChooser fileChooser = new FileChooser();
private File file = null;
void telechargerImage(ActionEvent event) {
File file = fileChooser.showOpenDialog(stage);
if (file != null) {
imagelog = new Image(file.toURI().toString());
image.setImage(imagelog);
}
}
您对
localhost
的使用可能会产生混淆。您是否正在尝试将文件保存到计算机上的特定目录(在这种情况下,您需要指定文件路径)?您是否正在尝试连接到计算机上设置的服务器,可能是通过ftp或其他方式?请提供更多关于“保存在localhost/images中”的详细信息。我只想将选定的图像保存在一个特定的路径中,该路径可能重复