Basically I have got a game with main class.
public static void main(String[] args) throws InterruptedException {
JFrame frame = new JFrame("Mini Tennis");
Game game = new Game();
frame.add(game);
frame.setSize(300, 400);
frame.setResizable(false);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
while (true) {
game.move();
game.repaint();
Thread.sleep(10);
}
}
When I am loading a class directly it working fine.
But when I am calling it from another class, it does not paint anything.
private void btnGameActionPerformed(java.awt.event.ActionEvent evt) {
try {
String[] args = null;
Game.main(args);
} catch (InterruptedException ex) {
Logger.getLogger(DrawerMain.class.getName()).log(Level.SEVERE, null, ex);
}
}
And after a few seconds it paints that I have lost a game. So basically game is running but I can't do anything and I don't see anything.