public static void getFileContextMenu(HBox fileIcon, String fileName, MouseEvent e, ClientObject client) {
ContextMenu cm = new ContextMenu();
MenuItem sb1 = new MenuItem("Delete File");
MenuItem sb2 = new MenuItem("Download File");
sb2.setOnAction(event -> {
DirectoryChooser directoryChooser = new DirectoryChooser();
directoryChooser.setTitle("Select download location");
File selectedDirectory =
directoryChooser.showDialog(Maus.getPrimaryStage());
FileContextMenu.selectedDirectory = selectedDirectory.getAbsolutePath();
try {
client.clientCommunicate("DOWNLOAD");
client.clientCommunicate(fileName);
} catch (IOException e1) {
Logger.log(Level.ERROR, e1.toString());
}
});
cm.getItems().addAll(sb1, sb2);
cm.show(fileIcon, e.getScreenX(), e.getScreenY());
}
FileContextMenu.java 文件源码
java
阅读 23
收藏 0
点赞 0
评论 0
项目:Maus
作者:
评论列表
文章目录