0

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.

Jarrod
  • 9,349
  • 5
  • 58
  • 73
  • 1
    Don't mix SWT & Swing! Doesn't SWT have a [`Shell`](http://help.eclipse.org/helios/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fswt%2Fwidgets%2FShell.html) or similar component? – Andrew Thompson Dec 26 '12 at 12:38
  • I know I should not, but I have to. –  Dec 26 '12 at 12:40
  • 2
    *"I know I should not, but I have to."* Extraordinary claims require extraordinary evidence or justification. What is your justification? – Andrew Thompson Dec 26 '12 at 12:42
  • because i haven't found any other way, to display a whole page in a jframe. i have tried alot :/ –  Dec 26 '12 at 12:45

1 Answers1

0

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