Boa tarde a todos, tenho um JFileChooser em um JFrame juntamente com um JPanel
gostaria que ao selecionar uma imagem no JFileChooser a imagem escolhida seja redimencionada e setada no JPanel.
até agora tenho este código.
privatevoidactionListenerButtonSelecionarImagem(){this.fileChooserImagem=newJFileChooser();FileNameExtensionFilterfilter=newFileNameExtensionFilter("Arquivos de Imagem","jpg","jpeg","gif","png");fileChooserImagem.setFileFilter(filter);fileChooserImagem.setAcceptAllFileFilterUsed(false);intselecionou=this.fileChooserImagem.showDialog(this,null);if(selecionou==JFileChooser.APPROVE_OPTION)if(fileChooserImagem.getSelectedFile()!=null)System.out.println(fileChooserImagem.getSelectedFile().getAbsolutePath());}
se alguem tiver alguma dica ou referencia fico grato.
Então pessoa, não estou conseguindo apresentar a imagem através do JPanel PFoto, não da erro algum, mas não apresenta a imagem escolhida!
segue meu código:
JFileChooserfileChooser=newJFileChooser();fileChooser.setDialogTitle("Escolha a Foto");fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);if(fileChooser.showOpenDialog(this)==JFileChooser.APPROVE_OPTION){Filearquivo=fileChooser.getSelectedFile();BufferedImagebi=ImageIO.read(arquivo);JImagePanelPainelFoto=newJImagePanel(bi);PFoto.add(PainelFoto,BorderLayout.CENTER);