private void initialize()
	{
		frame = new JFrame("Chat Client");
		frame.addWindowListener(new WindowAdapter()
        {
            @Override
            public void windowClosing(WindowEvent e)
            {
            	disconnect();
            }
        });
		frame.setBounds(100, 100, 596, 533);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.getContentPane().setLayout(null);
		
		connectionList = new List();
		connectionList.setBounds(448, 67, 124, 335);
		frame.getContentPane().add(connectionList);
		
		chatList = new List();
		chatList.setBounds(10, 67, 432, 364);
		frame.getContentPane().add(chatList);
		
		lblOnlineUsers = new JLabel("Offline");
		lblOnlineUsers.setHorizontalAlignment(SwingConstants.CENTER);
		lblOnlineUsers.setBounds(448, 47, 124, 14);
		frame.getContentPane().add(lblOnlineUsers);
		
		JLabel lblChat = new JLabel("Chat");
		lblChat.setBounds(10, 47, 46, 14);
		frame.getContentPane().add(lblChat);
		
		JLabel lblIPAddress = new JLabel("Connect to:");
		lblIPAddress.setBounds(161, 11, 90, 14);
		frame.getContentPane().add(lblIPAddress);
		
		txtIP = new JTextField();
		try
		{
			txtIP.setText(InetAddress.getLocalHost().getHostAddress());
		} catch (UnknownHostException e1)
		{
			txtIP.setText("Unknown IP!?");
		}
		txtIP.setBounds(230, 8, 112, 20);
		frame.getContentPane().add(txtIP);
		txtIP.setColumns(10);
		
		JLabel lblPort = new JLabel("Port:");
		lblPort.setBounds(359, 11, 38, 14);
		frame.getContentPane().add(lblPort);
		
		txtPort = new JTextField();
		txtPort.setText("9999");
		txtPort.setBounds(393, 8, 57, 20);
		frame.getContentPane().add(txtPort);
		txtPort.setColumns(10);
		
		btnConnect = new JButton("Connect");
		btnConnect.addActionListener(new ActionListener() 
		{
			public void actionPerformed(ActionEvent arg0) 
			{
				if(checkUsername(txtName.getText()))
				{
					try
					{
						UDPsocket = new DatagramSocket();
						IPaddress = InetAddress.getByName(txtIP.getText());
						portNumber = Integer.parseInt(txtPort.getText());
						dataBuffer = ("JOIN "+txtName.getText()).getBytes("UTF-8");
						sendPacket = new DatagramPacket(dataBuffer, dataBuffer.length, IPaddress, portNumber);
						UDPsocket.send(sendPacket);
						addMessage("Connecting to server ...");
						startDatagramListener();
					} catch (UnknownHostException e)
					{
						addMessage("Unable to get IP-Address"+e.getMessage());
					} catch (IOException e)
					{
						addMessage("Unable to connect"+e.getMessage());
					}
				}
				else
					addMessage("please use letters only");
			}
		});
		btnConnect.setBounds(460, 7, 112, 23);
		frame.getContentPane().add(btnConnect);
		
		btnDisconnect = new JButton("Disconnect");
		btnDisconnect.addActionListener(new ActionListener() 
		{
			public void actionPerformed(ActionEvent arg0) 
			{
				disconnect();
				btnConnect.setVisible(true);
				btnDisconnect.setVisible(false);
			}
		});
		btnDisconnect.setBounds(460, 7, 112, 23);
		frame.getContentPane().add(btnDisconnect);
		
		txtChat = new JTextField();
		txtChat.addActionListener(new ActionListener() 
		{
			public void actionPerformed(ActionEvent e) 
			{
				String message = "";
				if(chboxPriv.isSelected())
				{
					int tries = 0;
					while(tries<3)
					{
						String usernameTo = connectionList.getSelectedItem();
						if(!usernameTo.equals(null))
						{
							message = "MSG PRIVATE "+txtName.getText()+" "+usernameTo+" "+txtChat.getText();
							addMessage("Private message to "+usernameTo+": "+txtChat.getText());
							break;
						}
						else
							tries++;
					}
				}
				else
					message = "MSG PUBLIC "+txtName.getText()+" "+txtChat.getText();
				sendPacket(message);
				txtChat.setText("");
			}
		});
		txtChat.setBounds(10, 443, 562, 20);
		frame.getContentPane().add(txtChat);
		txtChat.setColumns(10);
		
		JLabel lblName = new JLabel("Name:");
		lblName.setBounds(10, 11, 46, 14);
		frame.getContentPane().add(lblName);
		
		txtName = new JTextField();
		txtName.setText("Testsubject");
		txtName.setBounds(52, 8, 90, 20);
		frame.getContentPane().add(txtName);
		txtName.setColumns(10);
		
		chboxPriv = new JCheckBox("Private message");
		chboxPriv.setBounds(448, 408, 124, 23);
		frame.getContentPane().add(chboxPriv);
		
		menuBar = new JMenuBar();
		frame.setJMenuBar(menuBar);
		
		mnFile = new JMenu("File");
		menuBar.add(mnFile);
		
		mntmNewClient = new JMenuItem("New Client");
		mnFile.add(mntmNewClient);
		
		mntmClose = new JMenuItem("Close");
		mnFile.add(mntmClose);
		
		mnOption = new JMenu("Option");
		menuBar.add(mnOption);
		
		mnHelp = new JMenu("Help");
		menuBar.add(mnHelp);
	}