Beispiel #1
0
  public static void main(String args[]) {
    QApplication.initialize(args);

    new Icons().show();

    QApplication.exec();
  }
Beispiel #2
0
  /** Entry point */
  public static void main(String args[]) {
    QApplication.initialize(args);

    ClientQT client = new ClientQT();

    client.serverListeners.add(client);

    LobbyWindow lobbyWindow = new LobbyWindow(client);
    client.serverListeners.add(lobbyWindow); // TODO on close, unregister
    lobbyWindow.show();

    // temp
    /*
    BoardWindow boardWindow = new BoardWindow(client, 666);
    client.serverListeners.add(boardWindow); //TODO on close, unregister
    boardWindow.show();*/
    /////

    client.createServer();

    int ca = 0;
    while (ca < args.length) {
      if (args[ca].equals("--connect")) {
        // Connect to a server
        ca++;
        String url = args[ca];
        int port = CardGameInfo.defaultServerPort;
        int colon = url.lastIndexOf(":");
        if (colon != -1) {
          port = Integer.parseInt(url.substring(colon + 1));
          url = url.substring(0, colon);
        }

        try {
          InetAddress addr = InetAddress.getByName(url);
          client.connectToServer(addr, port);
        } catch (UnknownHostException e) {
          System.out.println("Unknown host " + url);
          System.exit(1);
        } catch (IOException e) {
          e.printStackTrace();
          System.exit(1);
        }
      }
      ca++;
    }

    QApplication.exec();
  }