Display an image with Java Swing JLabel

1

I'm trying to display an image in an app using Swing Java. I get some frames from a video and display them as images.

    private void updateView(){
    Image tempCurrent = imageProcessor.toBufferedImage(currentImage);
    currentImageView.setIcon(new ImageIcon(tempCurrent));

    //JOptionPane.showMessageDialog(null, "um alo");

}

I'mnotaJavaprogrammer,butIneedtomaintainthiscode.Theprocedure"currentImageView.setIcon" should display an image in JPanel, but simply does nothing. The currentImaveView variable is the JLabel video. The funny part is that if I run the "JOptionPane", image ah appears.

Can anyone help me?

    
asked by anonymous 14.03.2017 / 20:52

1 answer

1

Use this code if you want an image inside jlabel:

// Import ImageIcon     
ImageIcon iconLogo = new ImageIcon("Images/YourCompanyLogo.png");

"nome da variable da jlabel".setIcon(iconLogo);
    
11.06.2017 / 19:41