I have an image displayed with an ImageView. When I perform a right click on it, I want to be able to choose a program to open the image with (ie. have an "Open With" menu item like on Windows). I know the solution to open the image with the default associated program and I know how to handle right clicking but I found nothing about the "Open With" menu action.
Asked
Active
Viewed 155 times
2
-
What's the problem exactly? Could you just list a bunch of programs and ask the user to choose one? Then use `Runtime.exec()`. – Steve Smith Aug 18 '17 at 08:17
-
I want to open the "Open With" window ([link](http://cdn.free-power-point-templates.com/articles/wp-content/uploads/2013/07/Open-with.jpg)) to let the user choose a program from its computer to open or edit the image. – Kenan Sauret Aug 18 '17 at 08:53
-
Possible dupe: https://stackoverflow.com/questions/16542359/how-to-make-the-open-with-dialog-box – Steve Smith Aug 18 '17 at 09:02
-
1Thank you for your answer, I manage to do it with `Runtime.exec()`. The shell command is just `openwith` so this do the trick : `Runtime runtime = Runtime.getRuntime(); runtime.exec("openwith " + file.getAbsolutePath());` – Kenan Sauret Aug 18 '17 at 09:15
-
[ContextMenu](https://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/ContextMenu.html)? – SedJ601 Aug 18 '17 at 14:01