public void init() {
		JFrame frame = new JFrame("baseClient");
		frame.setContentPane(this.mains);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.pack();
		frame.setVisible(true);

		// startButton.addActionListener(new ActionListener() {
		// @Override
		// public void actionPerformed(ActionEvent e) {
		// try {
		// int portNumber;
		// String portString = txtRouterPortNumber.getText();
		//
		// if (portString.matches("-{0,1}[0-9]+")) {
		// portNumber = Integer.parseInt(portString);
		//
		// if (portNumber < 0 || portNumber >= Math.pow(2, 16)) {
		// JOptionPane
		// .showMessageDialog(
		// null,
		// "Port Number must be between 0-65535!",
		// "Invalid Input!",
		// JOptionPane.ERROR_MESSAGE);
		// } else if (portNumber > 0
		// && portNumber < Math.pow(2, 10)) {
		// JOptionPane
		// .showMessageDialog(
		// null,
		// "You shouldn't pick a well known port (i.e., 1-1023),",
		// "Well Known Ports",
		// JOptionPane.INFORMATION_MESSAGE);
		// }
		// } else {
		// JOptionPane
		// .showMessageDialog(
		// null,
		// "Port Number must be a number between 0-65535!",
		// "Invalid Input!",
		// JOptionPane.ERROR_MESSAGE);
		// }
		//
		// if (routerSelect.isSelected()) {
		// } else if (serverSelect.isSelected()) {
		// ServerSocket Socket = new ServerSocket(6666); // port
		// // here
		// // can
		// // be
		// // anything
		// // as
		// // long
		// // as
		// // server
		// // router
		// // knows
		// // what
		// // it is
		//
		// /*
		// * We might want to consider adding a timeout feature to
		// * the server as it will hang forever waiting for a
		// * connection... we could also spawn a server thread to
		// * handle everything so as not to lock the gui. we can
		// * worry about this when the rest is functioning.
		// */
		//
		// while (serverSelect.isSelected()) // servers run loop
		// // forever
		// {
		// // accept new connections to the socket (blocks
		// // forever)
		// outputWindow.append("Waiting for client on port  :"
		// + Socket.getLocalPort() + "...\n");
		// Socket connectionSocket = Socket.accept();
		// outputWindow.append("Client connected on port    :"
		// + Socket.getLocalPort() + "...\n");
		// // create streams
		// BufferedReader receive = new BufferedReader(
		// new InputStreamReader(connectionSocket
		// .getInputStream()));
		// DataOutputStream send = new DataOutputStream(
		// connectionSocket.getOutputStream());
		// // get a new message from the socket
		// String message = receive.readLine();
		// // modify the sentence
		// String modifiedMsg = message.toUpperCase() + '\n';
		// // send modified message back
		// send.writeBytes(modifiedMsg);
		// }
		//
		// } else if (clientSelect.isSelected()) {
		// /*
		// * the following code will connect to the server router
		// * and then open a file for sending the data
		// */
		//
		// Socket clientSocket = new Socket(IPaddress, 6666); // port
		// // needs
		// // to
		// // be
		// // serverrouters
		// // port
		// // network output stream
		// DataOutputStream send = new DataOutputStream(
		// clientSocket.getOutputStream());
		// // network input stream
		// BufferedReader receive = new BufferedReader(
		// new InputStreamReader(clientSocket
		// .getInputStream()));
		// // get a lowercase message from the user (no
		// // verification or anything)
		// String message = fileName.getText();
		//
		// InputStream file = new FileInputStream(fileName
		// .getText());
		// BufferedReader reader = new BufferedReader(
		// new InputStreamReader(file));
		// String line = null;
		//
		// /*
		// * in the while loop below we need to add the statistics
		// * for average length of each line we send the average
		// * round trip time of each message.
		// */
		//
		// while ((line = reader.readLine()) != null) // loop to
		// // end of
		// // file
		// // sending
		// // every
		// // line
		// {
		// outputWindow.append("Sending TCP: " + line + "\n"); // we
		// // may
		// // want
		// // to
		// // only
		// // output
		// // statistics
		// // if
		// // its
		// // a
		// // long
		// // file
		// // convert to bytes and write to stream
		// send.writeBytes(line + '\n');
		// // receive the message back from the server
		// String modifiedMsg = receive.readLine();
		// outputWindow.append("Server TCP: " + modifiedMsg
		// + "\n");
		// // we are done here close the socket!
		//
		// }
		// clientSocket.close(); // we are done here
		// }
		// } catch (IOException h) {
		// }
		// }
		// });

		ItemListener select = new ItemListener() {
			@Override
			public void itemStateChanged(ItemEvent e) {
				if (e.getStateChange() == ItemEvent.SELECTED) {
					if (e.getItem() == routerSelect) {
						txtRouterName.setEnabled(false);
					} else if (e.getItem() == serverSelect) {
						txtServerDestinationIP.setEnabled(true);
					} else if (e.getItem() == clientSelect) {
						txtClientDestinationIP.setEnabled(true);
						fileName.setEnabled(true);
					}
				} else {
					if (e.getItem() == routerSelect) {
						txtRouterName.setEnabled(true);
						txtRouterName.setText("");
					} else if (e.getItem() == serverSelect) {
						txtServerDestinationIP.setEnabled(false);
					} else if (e.getItem() == clientSelect) {
						txtClientDestinationIP.setEnabled(false);
						fileName.setEnabled(false);
					}
				}
			}
		};

		routerSelect.addItemListener(select);
		serverSelect.addItemListener(select);
		clientSelect.addItemListener(select);

		KeyListener enter = new KeyListener() {
			@Override
			public void keyTyped(KeyEvent e) {

			}

			@Override
			public void keyPressed(KeyEvent e) {
			}

			@Override
			public void keyReleased(KeyEvent e) {
				if (e.getKeyCode() == KeyEvent.VK_ENTER) {
					startButton.doClick();
				}
			}
		};

		FocusListener focus = new FocusListener() {
			@Override
			public void focusGained(FocusEvent e) {
				((JTextField) e.getSource()).selectAll();
			}

			@Override
			public void focusLost(FocusEvent e) {

			}
		};

		txtRouterName.addKeyListener(enter);
		txtRouterPortNumber.addKeyListener(enter);
		txtServerDestinationIP.addKeyListener(enter);
		txtClientDestinationIP.addKeyListener(enter);
		fileName.addKeyListener(enter);

		txtRouterName.addFocusListener(focus);
		txtRouterPortNumber.addFocusListener(focus);
		txtServerDestinationIP.addFocusListener(focus);
		txtClientDestinationIP.addFocusListener(focus);
		fileName.addFocusListener(focus);

		try {
			txtMyHostname.setText(InetAddress.getLocalHost().getHostName());
		} catch (UnknownHostException e) {
			e.printStackTrace();
		}

		routerSelect.setSelected(true);
	}