title: Text Output in Java Swing
body: <p>When a user clicks a JButton in my Java-Swing application, a string is returned from a method and the user then needs to be able to read the string (somehow).  The JButton is within a JPanel.   My first thought was to create an 'alert' dialogue (thinking this would be easy), I tried to follow this example that looked easy: <a href="http://www.java2s.com/Code/Java/SWT-JFace-Eclipse/DialogExample.htm" rel="nofollow">http://www.java2s.com/Code/Java/SWT-JFace-Eclipse/DialogExample.htm</a></p>
  
  <p>I have not yet been able to confirm if this works because I do not know how to import the libraries into eclipse. For example <code>import org.eclipse.swt.SWT;</code> gives the error "... cannot be resolved".  </p>
  
  <p>So one possible solution is how to import in Eclipse. Another possible solution is to dynamically change the text within the JPanel somehow.                     </p>