title: How to display a text in textArea?
body: <p>I'm trying to display the public key of X.509 certificate in a <code>textArea</code> in a GUI instead of using <code>System.out.println()</code>. When I tried to display it inside the textArea using <code>setText()</code>, it didn't show it inside the <code>textArea</code>. The following method <code>readCertificate</code> extract the fields of the certificate and <code>ActionPerformed(ActionEvent e)</code> is simply a bottom that activate the action:</p>
  
  <pre><code>public void actionPerformed(ActionEvent e){
      File f = new File("/Users/AhmadAseeri/Desktop/cer.cer");
      Read r = new Read();
      r.readCertificate(f);
  }
  
  public void readCertificate(File f) throws Exception {
      CertificateFactory cf = CertificateFactory.getInstance("X.509");
      BufferedInputStream in = new BufferedInputStream(new FileInputStream(f));
      while (in.available() &gt; 0) {
          Certificate cert = cf.generateCertificate(in);
          String c=String.valueOf(cert.getPublicKey());
          JTextArea textArea= new JTextArea();
          textArea.setText(c);  
      }
      in.close();
  } 
  </code></pre>