我有以下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()尝试了所有内容和每个组合。
它应该直接出现。希望有人可以帮助我。
答案 0 :(得分:0)
我刚刚完成了一项工作,我在看到它后改变了我的JFrame大小。所以它“调整大小”,画布是可见的;)