Placeholder in JTextField - Java Swing
<p>How to put a placeholder JTextArea? I do not want to use a label , I think the placeholder is more elegant.</p>

<pre><code>private void initialize() {
    frame = new JFrame();

    JTextField txtSfas = new JTextField();
    TextPrompt txtSfas = new TextPrompt("First Name", txtSfas);
    frame.getContentPane().add(txtSfas, BorderLayout.CENTER);
    txtSfas.setColumns(2);

}
</code></pre>

<p><a href="https://i.stack.imgur.com/hHrCC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hHrCC.png" alt="image"></a></p>

<p>error:</p>

<blockquote>
  <p>TextPrompt cannot be resolved to a type</p>
</blockquote>

<p><a href="https://i.stack.imgur.com/kWdAe.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kWdAe.jpg" alt="error"></a></p>