setLayout(null); // That's your problem
Don't set the layout to null
, why are you doing this? Remove this line and add the internals like this:
public void actionPerformed(ActionEvent ae) {
PacmanGame obj = new PacmanGame();
obj.setVisible(true);
obj.setSize(....);//and so on
dsktop.add(obj);
}