start MagicFrame using invokeLater

master
melvin 2011-07-13 17:01:35 +08:00
parent c294dde926
commit f57b52a048
2 changed files with 6 additions and 6 deletions

View File

@ -3,6 +3,7 @@ package magic;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import javax.swing.SwingUtilities;
import magic.data.CardDefinitions;
import magic.data.CardEventDefinitions;
@ -37,7 +38,11 @@ public class MagicMain {
public static void main(String args[]) throws IOException {
initialize();
new MagicFrame();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new MagicFrame();
}
});
}
public static String getGamePath() {

View File

@ -287,7 +287,6 @@ public class MagicFrame extends JFrame implements ActionListener {
}
public void showTournament() {
gamePanel=null;
if (tournament!=null) {
final TournamentPanel newTournamentPanel=new TournamentPanel(this,tournament);
@ -395,27 +394,23 @@ public class MagicFrame extends JFrame implements ActionListener {
}
public void resetGame() {
if (gamePanel!=null) {
gamePanel.getController().resetGame();
}
}
public void concedeGame() {
if (gamePanel!=null) {
gamePanel.getController().concede();
}
}
public void nextGame() {
tournament.updateDifficulty();
openGame(tournament.nextGame(true));
}
private void openGame(final MagicGame game) {
final ZoneBackgroundLabel backgroundLabel=new ZoneBackgroundLabel();
backgroundLabel.setGame(true);
gamePanel=new GamePanel(this,game,backgroundLabel);