title: Check if the content of text area is empty (java)
body: <p>I am trying to read data from a <code>textarea (JTextArea)</code> and store the contents into a <code>table(MySQL)</code>. I don't want the <code>INSERT</code> query to execute if the textarea is empty or has a newline without any text. I tried the following code but it does not work. Could someone help me out.  Thanks.</p>
  
  <pre><code>String data=todo_area.getText();//read contents of text area into 'data'
  String newline = System.getProperty("line.separator");
  boolean hasNewline = data.contains(newline);
  
  if (data == null || !data.trim().equals("")||hasNewline==false)
  {
      //INSERT  query
  }
  </code></pre>