我有焦土习俗JPanel,我用Netbeans GUI公司的建筑商将其 ad到我的身边,但背景却获得了变化! 我可以看一看这个圈子,照相。 什么错误?
public class Board extends JPanel{
private Player player;
public Board(){
setOpaque(false);
setBackground(Color.BLACK);
}
public void paintComponent(Graphics g){
super.paintComponent(g);
g.setColor(Color.red);
g.fillOval(player.getxCenter(), player.getyCenter(), player.getRadius(), player.getRadius());
}
public void updatePlayer(Player player){
this.player=player;
}
}