Pergunta

I have the following JPanel:

import java.awt.BorderLayout;
import java.awt.Dimension;

import javax.swing.JPanel;

public class Watcher extends JPanel {
    private static final long serialVersionUID = 1L;
    final CardLoader canvas;
    private AvatarLoader avatarPic; 
    private String username;

    public Watcher(String username){    
        this.username = username;
        avatarPic = new AvatarLoader(username);

        canvas = new CardLoader();
        canvas.setSize(new Dimension(200, 135));

        this.setLayout(new BorderLayout());
        this.add(avatarPic, BorderLayout.CENTER);
        this.add(canvas, BorderLayout.SOUTH);

        canvas.setVisible(true);
    }

    public void load(){
        canvas.connect();
        canvas.setGamerCardURL(this.username);
    }
}

The Canvas is a SWT-Browser, but it only appears after resizing my JFrame.

I tried everything and every combination with revalivate()/validate() and repaint().

It should just appear directly. Hope someone can help me.

Foi útil?

Solução

I just did a work around, i am changing my JFrame size after it is visible. so it "resizes" and the canvas is Visible ;)

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top