public static void main(String[] args) {

		if(args.length==0){
			host="127.0.0.1";
			port=64501;
		}else{
			host = args[0];
			try {
				port = Integer.parseInt(args[1]);
			} catch (NumberFormatException e) {
				System.out.println("Parse int error.");
				return;
			}
		}


		stackLayout = new StackLayout();
		shell.setLayout(stackLayout);


		/**
		 * connection composite
		 */
		final ConnectionComposite connectionComposite = new ConnectionComposite(shell, SWT.NONE);
		connectionComposite.setLayout(new FillLayout(SWT.VERTICAL));
		connectionComposite.setHostText(host);
		connectionComposite.setPortText(port);
		connectionComposite.getConnectButton().addSelectionListener(new SelectionListener() {

			@Override
			public void widgetSelected(SelectionEvent arg0) {
				host = connectionComposite.getHostText();

				try{
					port = Integer.parseInt(connectionComposite.getPortText());
				}catch(NumberFormatException e){
					port=64501;
				}

				/**
				 * connection
				 */
				connectionThread = new Thread(new QuizConnect());
				connectionThread.start();
			}

			@Override
			public void widgetDefaultSelected(SelectionEvent arg0) {
				widgetSelected(arg0);
			}
		});	

		/**
		 * game composite configure
		 */
		mainGameComposite = new GameComposite(shell, SWT.NONE);
		mainGameComposite.setLayout(new FillLayout(SWT.VERTICAL));
		mainGameComposite.getAnsweredCapitalText().addKeyListener(new KeyListener() {
			@Override
			public void keyReleased(KeyEvent e) {				
				if (e.keyCode == 13 && !((Text)e.getSource()).getText().equals("")) {
					try {
						sQueue.put(mainGameComposite.getAnsweredCapital());
						((Text)e.getSource()).setText("");
					} catch (InterruptedException e1) {
						e1.printStackTrace();
					}
				}
			}	
			@Override
			public void keyPressed(KeyEvent e) {}
		});

		shell.addDisposeListener(new DisposeListener() {

			@Override
			public void widgetDisposed(DisposeEvent e) {
				connectionThread.interrupt();
			}
		});

		stackLayout.topControl = connectionComposite;

		shell.pack();
		shell.open();			

		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
		display.dispose();
	}