@Override
	public void actionPerformed(ActionEvent e) {
		//Set ip address
		if (e.getSource() == ipSetButton) {
			ipAddress = ipField.getText().trim();
			local.println("IP Address set to: " + ipAddress);
			log.setCaretPosition(log.getDocument().getLength());
		}
		// Handle appleButton action.
		if (e.getSource() == appleButton) {
			local.println("Sending apple...");
			log.setCaretPosition(log.getDocument().getLength());
			sendNetworkObject(new Apple(), defaultPort);
			//sendNetworkObject(new RawGoods(3,0,0), test2Port);
			
		}
		if (e.getSource() == pearButton) {
			local.println("Sending pear...");
			log.setCaretPosition(log.getDocument().getLength());
			sendNetworkObject(new Pear(), defaultPort);
			//sendNetworkObject(new RawGoods(0,1,0), defaultPort);
			
		}
		if (e.getSource() == bananaButton) {
			local.println("Sending banana...");
			log.setCaretPosition(log.getDocument().getLength());
			sendNetworkObject(new Banana(), defaultPort);
			//sendNetworkObject(new RawGoods(0,0,1), defaultPort);
			
		}
		if (e.getSource() == emptyWasteButton) {
			local.println("Emptying waste bin...");
			log.setCaretPosition(log.getDocument().getLength());
			sendNetworkString("emptyWaste", ipAddress, "44474");
			//sendNetworkString("emptyWaste", "44474"); //44474 is the waste port
			
		}
		if (e.getSource() == emptyBinButton) {
			local.println("Emptying cut fruit bin...");
			log.setCaretPosition(log.getDocument().getLength());
			sendNetworkString("emptyFruit", "44462"); //44462 is the fruit bin port
			
		}
		if (e.getSource() == integerButton) {
			local.println("Sending Integer object...");
			log.setCaretPosition(log.getDocument().getLength());
			sendNetworkObject(new Integer(10), integerPort);
			
		}
		if (e.getSource() == testButton1) {
			local.println("Sending String object...");
			log.setCaretPosition(log.getDocument().getLength());
			//sendNetworkObject(new Integer(5), test1Port);
			sendNetworkString("devinisawse", test1Port);
			
		}
		if (e.getSource() == testButton2) {
			local.println("Sending Integer object...");
			log.setCaretPosition(log.getDocument().getLength());
			//sendNetworkObject(new Integer(-12345), test2Port);
			
		}
		log.setCaretPosition(log.getDocument().getLength());
	}