我有以下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);
}
}
Canvas 是一个 SWT 浏览器,但它仅在调整我的 JFrame 大小后才会出现。
我尝试了所有与 revalivate()/validate() 和 repaint() 的组合。
它应该直接出现。希望可以有人帮帮我。