public class Game extends JFrame implements ActionListener{
Drawing object=new Drawing();
Timer t=new Timer(1,this);
int score;
ArrayList<Enemy> bombs=new ArrayList<Enemy>();
public Game()
{
t.start();
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(700,600);
setVisible(true);
add(object);
add(new JLabel("Hello"));
validate();
createBombs();
}
为什么我无法同时添加JLabel和对象。只有其中一个出现。 (JLabel)。添加多个对象
你得到的错误是什么?我们可以看到添加功能吗? –
什么样的对象是绘图?你是否能够在任何其他控件上显示它?我最好的猜测是绘制得到添加没有任何问题,但它实际上并没有绘制的东西,所以它似乎没有被添加。 –
你知道JFrame的默认布局管理器是什么吗? – FredK