How to upload photos from one frame to another?

0

Good I'm doing a project for the U! about a film portfolio and I have two classes of one admin and another of portfolio! in the admin class I already have ready in a JFrame to upload photos from the computer but now I can be able to come out in the portfolio class in a JLabel when the image is uploaded! if someone can help me here I leave the code I did to upload the photos in JFrame of the admin class !! Thank you very much

private void foto1ActionPerformed(java.awt.event.ActionEvent evt) {                                      
        // TODO add your handling code here:
    JFileChooser dlg = new JFileChooser();
    dlg.setFileFilter(filter1);

    int option = dlg.showOpenDialog(this);
    if(option==JFileChooser.APPROVE_OPTION){
        String fil = dlg.getSelectedFile().getPath();
        poster1.setIcon(new ImageIcon(fil));

        ImageIcon icon = new ImageIcon(fil);

        Image img = icon.getImage();

        Image newimg = img.getScaledInstance(400, 240, java.awt.Image.SCALE_SMOOTH);

        ImageIcon newIcon = new ImageIcon(newimg);

        poster1.setIcon(newIcon);
        poster1.setSize(400,300 );

        RutaImagen="";
    }
}
    
asked by Luis Ale Morales Perez 29.10.2018 в 05:15
source

0 answers