public void serialEvent(SerialPortEvent evt) {
        if (evt.getEventType() == SerialPortEvent.DATA_AVAILABLE)
        {
            try
            {
                byte singleData = (byte)input.read();
                
                if (singleData == 'R') {
                	System.out.println("here1");
                	// Hard panel just started up, request its input control states
                	writeData('S');      	
                }
                
                // Hard panel is sending control states 
                // byteCounter  = 0: button 1-8
                //				= 1: button 9-16
                //				= 2: button 17-24
                //				= 3: switch 1-8
                //				= 4: switch 9-16
                //				= 5: switch 17-24
                else {
                	if (byteCounter == 0)
                		System.out.println("Buttons:\n");
                	else if (byteCounter == 3)
                		System.out.println("Switches:\n");
                	
                	//window.handleData(byteCounter, singleData);
                	byteCounter++;
                	
                	if (byteCounter==6)
                		byteCounter=0;
                	
                	String s1 = String.format("%8s", Integer.toBinaryString(singleData & 0xFF)).replace(' ', '0');
                    System.out.println("M: " + s1);
                }
                
     
            }
            catch (Exception e)
            {
                System.out.println("Failed to read data. (" + e.toString() + ")");
            }
        }
    }