JFileChooser
(つまり、ユーザーが自分のプロフィール写真を設定したい)で選択した画像をアップロードして表示する必要がありJFrame
ます..どうすればよいですか?
ファイルを選択するための私のコードは次のとおりです。
private void UploadImageActionPerformed(java.awt.event.ActionEvent evt) {
int returnVal = fileChosser.showOpenDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fileChosser.getSelectedFile();
// What to do with the file
// I want code for this part
try {
//code that might create an exception
}
catch (Exception e1) {
e.printStackTrace();
}
}
}