title: Alternative to write in Console
body: <p>I have a Serial communication between my pc and an Arduino. </p>
  
  <p>I have implemented the Serial Communication thanks to this example:
  <a href="http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port" rel="nofollow">http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port</a></p>
  
  <p>I´m able to send (From Console) and receive data from Arduino without problems.</p>
  
  <p>Now I created a GUI which is displaying the Arduino´s data. Everything is working until here.</p>
  
  <pre><code>-----------------------------
  EXAMPLE : 
  I send from console: "&gt;?L"
  I receive "&gt;L|50|" 
  ------------------------------
  </code></pre>
  
  <p>In the example 50 is a value of a sensor mounted on arduino.</p>
  
  <p>The problem is: </p>
  
  <p>I want to add some buttons to my GUI and I want that the button act exactly in same way of the action of writing on the console. 
  So, I click a button and it sends ">?L" to my Arduino. I´m not able to do that, is there someone who can help me?
  Of course I know the structure that there is under a button:</p>
  
  <pre><code>JButton btnLength = new JButton("Length");
          btnLength.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent e) {
              }
  }
  </code></pre>
  
  <p>My question is: What do I have to write in the actionPerformed function?</p>
  
  <p>Thanks,
  Fab.</p>