JImagePanel Problema

0 respostas
C

Malta, estou a tentar usar o jImagePanel, mas não estou a conseguir!

Estou a tentar colocar uma imagem de undo num jPanel da seguinte forma:

public class campoTiro extends javax.swing.JFrame 
{
    private JImagePanel jPprincipal;
    
    /**
     * Creates new form campoTiro
     */
    public campoTiro() throws IOException 
    {
        initComponents();
        imagem();
        preparaFrame();
    }
    
    private void imagem() throws IOException
    {
        BufferedImage image = ImageIO.read(Imagens.DaOCaminho.class.getClassLoader().getResource("Imagens/Wallpapers.jpg"));
        
        if (jPprincipal == null) jPprincipal = new JImagePanel(image);  
              
        jPprincipal.setImage(image);  
        jPanel1.add(jPprincipal);  
        jPanel1.repaint();  
        jPanel1.validate(); 
    }

Não apresenta erros mas também não apresenta a imagem... O que está mal?

Criado 22 de março de 2012
Respostas 0
Participantes 1