0
我正在創建一個現代命令行應用程序,它需要命令並給出值,我創建了許多命令,我需要知道的是我如何從互聯網下載圖像,它保存在一個文件,然後預覽在JOptionPane
(JFrame
)的形象,作爲一個虛擬的代碼,我希望這種情況發生:在JOptionPane上下載,保存和預覽圖像
// REGULAR JAVA:
String link = JOptionPane.showInputDialog(null, "Enter The Link of the image:");
String directoryToBeSavedIn = JOptionPane.showInputDialog(null, "Enter directory");
// What I need:
saveImage(link, directoryToBeSavedInAndName); // Download and save(e.g. C:\Down.png)
Image downloadedImage = new Image(directoryToBeSavedInAndName); // Specifies an Image type object, that is the downloaded Image
JOptionPane.showPicture(downloadedImage); // this calls the JOptionPane, with showPicture as a panel that will show a picture to the user.
虛幻代碼: saveImage();
,Image .. = new Image();
,showPicture();