// Path: gameManager/src/org/dipgame/gameManager/utils/BareBonesBrowserLaunch.java
// public class BareBonesBrowserLaunch {
// 
// 	static final String[] browsers = { "google-chrome", "firefox", "opera",
// 			"epiphany", "konqueror", "conkeror", "midori", "kazehakase",
// 			"mozilla" };
// 	static final String errMsg = "Error attempting to launch web browser";
// 
// 	public static void openURL(String url) {
// 		try { // attempt to use Desktop library from JDK 1.6+
// 			Class<?> d = Class.forName("java.awt.Desktop");
// 			d.getDeclaredMethod("browse", new Class[] { java.net.URI.class })
// 					.invoke(d.getDeclaredMethod("getDesktop").invoke(null),
// 							new Object[] { java.net.URI.create(url) });
// 			// above code mimicks: java.awt.Desktop.getDesktop().browse()
// 		} catch (Exception ignore) { // library not available or failed
// 			String osName = System.getProperty("os.name");
// 			try {
// 				if (osName.startsWith("Mac OS")) {
// 					Class.forName("com.apple.eio.FileManager")
// 							.getDeclaredMethod("openURL",
// 									new Class[] { String.class })
// 							.invoke(null, new Object[] { url });
// 				} else if (osName.startsWith("Windows"))
// 					Runtime.getRuntime().exec(
// 							"rundll32 url.dll,FileProtocolHandler " + url);
// 				else { // assume Unix or Linux
// 					String browser = null;
// 					for (String b : browsers)
// 						if (browser == null
// 								&& Runtime.getRuntime()
// 										.exec(new String[] { "which", b })
// 										.getInputStream().read() != -1)
// 							Runtime.getRuntime().exec(
// 									new String[] { browser = b, url });
// 					if (browser == null)
// 						throw new Exception(Arrays.toString(browsers));
// 				}
// 			} catch (Exception e) {
// 				JOptionPane.showMessageDialog(null,
// 						errMsg + "\n" + e.toString());
// 			}
// 		}
// 	}
// 
// }
// 
// Path: gameManager/src/org/dipgame/gameManager/utils/TextBox.java
// public class TextBox extends JTextPane {
// 
// 	public TextBox(Color background) {
// 		this.setBackground(background);
// 		this.setAutoscrolls(true);
// 		this.setEditable(false);
// 	}
// 
// 	public TextBox(String description, Color background) {
// 		this(background);
// 		append(description, Color.black, false);
// 	}
// 
// 	public String getText() {
// 		return this.getText();
// 	}
// 
// 	public void append(String s, Color color, Boolean bold) {
// 		try {
// 			StyledDocument doc = super.getStyledDocument();
// 			SimpleAttributeSet sa = new SimpleAttributeSet();
// 			StyleConstants.setAlignment(sa, StyleConstants.ALIGN_JUSTIFIED);
// 			StyleConstants.setLeftIndent(sa, 10);
// 			StyleConstants.setRightIndent(sa, 10);
// 			StyleConstants.setSpaceAbove(sa, 5);
// 			StyleConstants.setSpaceBelow(sa, 5);
// 			Style style = doc.addStyle("name", null);
// 			StyleConstants.setForeground(style, color);
// 			StyleConstants.setBold(style, bold);
// 			doc.insertString(doc.getLength(), s, style);
// 			doc.setParagraphAttributes(0, doc.getLength(), sa, false);
// 		} catch (BadLocationException exc) {
// 			exc.printStackTrace();
// 		}
// 	}
// 
// 	public void revalidateAll() {
// 		this.revalidate();
// 	}
// }


import java.awt.BorderLayout;
import java.awt.Choice;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.io.StringReader;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.HashMap;
import java.util.List;
import java.util.Vector;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import org.dipgame.gameManager.utils.BareBonesBrowserLaunch;
import org.dipgame.gameManager.utils.TextBox;

			playerMenu.insert(line, index++);
		}
		playerMenu.insert(Utils.LEAVE_EMPTY, index++);
		return playerMenu;
	}

	private Component createAllPlayerSettings() {
		JPanel allPlayerSettings = new JPanel();
		allPlayerSettings.setBackground(Utils.CYAN);
		
		JPanel border = new JPanel();
		border.setBorder(BorderFactory.createTitledBorder("Set the same type to all players"));
		border.setPreferredSize(new Dimension(290,65));
		border.setBackground(Utils.CYAN);
		
		allChoice = createPlayerMenu(availablePlayerNames);
		border.add(allChoice);
		
		setAllPlayers = new JButton("Set all players");
		setAllPlayers.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseReleased(MouseEvent e) {
				for(Choice menu: choices){
					menu.select(allChoice.getSelectedItem());
				}
			}
		});
		
		border.add(setAllPlayers);
		

// Path: gameManager/src/org/dipgame/gameManager/utils/BareBonesBrowserLaunch.java
// public class BareBonesBrowserLaunch {
// 
// 	static final String[] browsers = { "google-chrome", "firefox", "opera",
// 			"epiphany", "konqueror", "conkeror", "midori", "kazehakase",
// 			"mozilla" };
// 	static final String errMsg = "Error attempting to launch web browser";
// 
// 	public static void openURL(String url) {
// 		try { // attempt to use Desktop library from JDK 1.6+
// 			Class<?> d = Class.forName("java.awt.Desktop");
// 			d.getDeclaredMethod("browse", new Class[] { java.net.URI.class })
// 					.invoke(d.getDeclaredMethod("getDesktop").invoke(null),
// 							new Object[] { java.net.URI.create(url) });
// 			// above code mimicks: java.awt.Desktop.getDesktop().browse()
// 		} catch (Exception ignore) { // library not available or failed
// 			String osName = System.getProperty("os.name");
// 			try {
// 				if (osName.startsWith("Mac OS")) {
// 					Class.forName("com.apple.eio.FileManager")
// 							.getDeclaredMethod("openURL",
// 									new Class[] { String.class })
// 							.invoke(null, new Object[] { url });
// 				} else if (osName.startsWith("Windows"))
// 					Runtime.getRuntime().exec(
// 							"rundll32 url.dll,FileProtocolHandler " + url);
// 				else { // assume Unix or Linux
// 					String browser = null;
// 					for (String b : browsers)
// 						if (browser == null
// 								&& Runtime.getRuntime()
// 										.exec(new String[] { "which", b })
// 										.getInputStream().read() != -1)
// 							Runtime.getRuntime().exec(
// 									new String[] { browser = b, url });
// 					if (browser == null)
// 						throw new Exception(Arrays.toString(browsers));
// 				}
// 			} catch (Exception e) {
// 				JOptionPane.showMessageDialog(null,
// 						errMsg + "\n" + e.toString());
// 			}
// 		}
// 	}
// 
// }
// 
// Path: gameManager/src/org/dipgame/gameManager/utils/TextBox.java
// public class TextBox extends JTextPane {
// 
// 	public TextBox(Color background) {
// 		this.setBackground(background);
// 		this.setAutoscrolls(true);
// 		this.setEditable(false);
// 	}
// 
// 	public TextBox(String description, Color background) {
// 		this(background);
// 		append(description, Color.black, false);
// 	}
// 
// 	public String getText() {
// 		return this.getText();
// 	}
// 
// 	public void append(String s, Color color, Boolean bold) {
// 		try {
// 			StyledDocument doc = super.getStyledDocument();
// 			SimpleAttributeSet sa = new SimpleAttributeSet();
// 			StyleConstants.setAlignment(sa, StyleConstants.ALIGN_JUSTIFIED);
// 			StyleConstants.setLeftIndent(sa, 10);
// 			StyleConstants.setRightIndent(sa, 10);
// 			StyleConstants.setSpaceAbove(sa, 5);
// 			StyleConstants.setSpaceBelow(sa, 5);
// 			Style style = doc.addStyle("name", null);
// 			StyleConstants.setForeground(style, color);
// 			StyleConstants.setBold(style, bold);
// 			doc.insertString(doc.getLength(), s, style);
// 			doc.setParagraphAttributes(0, doc.getLength(), sa, false);
// 		} catch (BadLocationException exc) {
// 			exc.printStackTrace();
// 		}
// 	}
// 
// 	public void revalidateAll() {
// 		this.revalidate();
// 	}
// }


// Path: gameManager/src/org/dipgame/gameManager/MainPanel.java
import java.awt.BorderLayout;
import java.awt.Choice;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.io.StringReader;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.HashMap;
import java.util.List;
import java.util.Vector;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import org.dipgame.gameManager.utils.BareBonesBrowserLaunch;
import org.dipgame.gameManager.utils.TextBox;

			playerMenu.insert(line, index++);
		}
		playerMenu.insert(Utils.LEAVE_EMPTY, index++);
		return playerMenu;
	}

	private Component createAllPlayerSettings() {
		JPanel allPlayerSettings = new JPanel();
		allPlayerSettings.setBackground(Utils.CYAN);
		
		JPanel border = new JPanel();
		border.setBorder(BorderFactory.createTitledBorder("Set the same type to all players"));
		border.setPreferredSize(new Dimension(290,65));
		border.setBackground(Utils.CYAN);
		
		allChoice = createPlayerMenu(availablePlayerNames);
		border.add(allChoice);
		
		setAllPlayers = new JButton("Set all players");
		setAllPlayers.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseReleased(MouseEvent e) {
				for(Choice menu: choices){
					menu.select(allChoice.getSelectedItem());
				}
			}
		});
		
		border.add(setAllPlayers);
		

		allPlayerSettings.add(border);
